Skip to main content

Patent Drafting Assistant

专利撰写助手 — AI-powered patent disclosure drafting

MIT License Python 3.10+ FastAPI Anthropic SDK PyPI Downloads

Features • Quick Start • Usage • Structure • Customize • Contributing


Input your core technical concept and let AI generate a complete 10-chapter Chinese patent disclosure. Supports streaming generation, per-chapter editing, auto figure prompts, version history, and DOCX/Markdown export — all through a clean local web UI.

Features

  • AI-driven drafting — Generate a complete patent disclosure from a single technical concept
  • 10-chapter standard structure — Follows Chinese patent disclosure conventions
  • Concept-first workflow — Analyze your concept first, then generate chapters based on structured extraction
  • Technical feature analysis — AI extracts key elements, innovation points, and expected effects
  • Streaming generation — Watch each chapter generate in real time via SSE
  • Per-chapter editing — Edit any chapter manually, switch between Markdown edit and preview modes
  • Auto figure prompts — AI inserts [Figure N: description] markers; right panel shows the figure checklist
  • Version history — Every save creates a snapshot; rollback anytime
  • DOCX export — Professional Word documents with correct Chinese fonts (Song Ti / Hei Ti)
  • Markdown export — Plain text for other editing tools
  • Zero-config LLM — Auto-reads API keys from Claude Code settings or environment variables

Quick Start

Prerequisites

  • Python 3.10+
  • An Anthropic-compatible LLM API (e.g. DeepSeek, OpenAI, Claude)

Install

git clone https://github.com/Dyp130/Patent-assistant.git
cd Patent-assistant
pip install -r requirements.txt

Configure

Copy the example env file and set your credentials:

cp .env.example .env
# Edit .env with your API key, base URL, and model

Or export as environment variables:

export ANTHROPIC_BASE_URL="https://api.deepseek.com"
export ANTHROPIC_AUTH_TOKEN="your-api-key"
export ANTHROPIC_MODEL="deepseek-chat"

If you have Claude Code installed, the app automatically reads API config from ~/.claude/settings.json.

Launch

python run.py

Open http://127.0.0.1:8000

Usage

Workflow

Step Action
1 Click New Patent Draft, choose patent type, and enter your core technical concept
2 Click Save Concept, then optionally Analyze Technical Features
3 Click Generate All (or select individual chapters via AI Generate)
4 Review, edit, and preview each chapter
5 Export as DOCX or Markdown

Screenshots

Screenshots coming soon — run python run.py to see it in action.

Chapter Structure

# Chapter (EN) Chapter (中文) Description
1 Title 发明名称 Concise, ≤25 characters, no marketing terms
2 Technical Field 技术领域 Specific technical domain
3 Background Art 背景技术 2-3 existing solutions and their shortcomings
4 Purpose 发明目的 Technical problems to be solved
5 Technical Solution 技术方案 Core chapter: elements, relationships, mechanisms
6 Beneficial Effects 有益效果 Quantitative/qualitative advantages
7 Drawing Description 附图说明 Numbered list of all required figures
8 Detailed Embodiments 具体实施方式 At least one complete, reproducible embodiment
9 Alternative Embodiments 替代方案 Optional variants and alternatives
10 Key Points & Protection 关键点与保护点 Innovation points ranked by importance

Customizing

Edit config/prompts.yaml to adjust AI generation behavior for each chapter — no code changes needed. Variables use {placeholder} syntax.

chapter_5_technical_solution:
  system: |
    你是一位资深的中国专利代理人。
    请根据以下核心技术构思,撰写"技术方案"章节。
    ...
  user: |
    发明名称:{title}
    核心技术构思:{technical_concept}
    ...

Project Structure

Patent-assistant/
├── config/
│   ├── settings.py           # Configuration & env reading
│   ├── prompts.yaml          # AI prompt templates
│   └── chapter_schema.yaml   # Chapter definitions
├── src/
│   ├── main.py               # FastAPI application entry
│   ├── db/                   # Database setup (SQLAlchemy + SQLite)
│   ├── routes/               # Project, chapter, generation, export APIs
│   ├── models/               # ORM models and Pydantic schemas
│   ├── services/             # AI generation, analysis, export
│   ├── templates/            # Jinja2 HTML templates
│   └── static/               # CSS & vanilla JavaScript
├── .env.example              # API configuration template
├── requirements.txt
├── run.py                    # Launch script
└── README.md

Tech Stack

Layer Technology
Backend Python 3.10+ / FastAPI / SQLAlchemy
Database SQLite (zero-config, auto-created)
Frontend Jinja2 + vanilla JS + SSE streaming
AI Anthropic SDK (DeepSeek / OpenAI / Claude compatible)
Export python-docx (Chinese font configured), markdown
Design Zero build tools, single CSS file

Contributing

Contributions are welcome — see CONTRIBUTING.md.

  1. Fork the repo
  2. Create a branch (git checkout -b feat/your-feature)
  3. Commit your changes
  4. Push and open a Pull Request

License

MIT — see LICENSE.

Metadata

Release files for patent-drafting-assistant 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patent-drafting-assistant 0.1.1
File Size Uploaded
patent_drafting_assistant-0.1.1.tar.gz 36.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for patent-drafting-assistant 0.1.1
File Interpreter ABI Platform
patent_drafting_assistant-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 79.1 kB

Release files / patent_drafting_assistant-0.1.1.tar.gz

Download URL patent_drafting_assistant-0.1.1.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0c3162e2b4f9918bb3d374968c82b8124fb787da532a768b7c48dd6f394642c8
BLAKE2b-256 checksum
How to use checksums
f9a80465a3a38912a2d7fa62ddf0a05fe1e4ef17d63bb9300890e781d5659acd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / patent_drafting_assistant-0.1.1-py3-none-any.whl

Download URL patent_drafting_assistant-0.1.1-py3-none-any.whl
Size 42.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
319afc6b36e96080840f9d2f77b35ac264fb42b6cae92bca560e2b27c226f4a1
BLAKE2b-256 checksum
How to use checksums
c027605fd75cbbf669f16346f35a306e5f8232756881ceaaed7aa3c6070787d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page