docpilot-ai 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. docpilot_ai-0.2.0/.claude/settings.local.json +8 -0
  2. docpilot_ai-0.2.0/PKG-INFO +287 -0
  3. docpilot_ai-0.2.0/README.md +250 -0
  4. docpilot_ai-0.2.0/out_test/pptx.log +28 -0
  5. docpilot_ai-0.2.0/out_test/presentation.md +165 -0
  6. docpilot_ai-0.2.0/out_test/pricing.log +26 -0
  7. docpilot_ai-0.2.0/out_test/pricing.md +81 -0
  8. docpilot_ai-0.2.0/out_test/pricing_assets/image-001.png +0 -0
  9. docpilot_ai-0.2.0/out_test/quotation.log +26 -0
  10. docpilot_ai-0.2.0/out_test/quotation.md +54 -0
  11. docpilot_ai-0.2.0/out_test/quotation2.log +24 -0
  12. docpilot_ai-0.2.0/out_test/quotation_assets/image-001.png +0 -0
  13. docpilot_ai-0.2.0/parsedoc_cli.py +19 -0
  14. docpilot_ai-0.2.0/pyproject.toml +60 -0
  15. docpilot_ai-0.2.0/quotation.md +54 -0
  16. docpilot_ai-0.2.0/quotation_assets/image-001.png +0 -0
  17. docpilot_ai-0.2.0/src/parsedoc/__init__.py +3 -0
  18. docpilot_ai-0.2.0/src/parsedoc/__main__.py +6 -0
  19. docpilot_ai-0.2.0/src/parsedoc/ai/__init__.py +21 -0
  20. docpilot_ai-0.2.0/src/parsedoc/ai/base.py +59 -0
  21. docpilot_ai-0.2.0/src/parsedoc/ai/cache.py +47 -0
  22. docpilot_ai-0.2.0/src/parsedoc/ai/compatible.py +58 -0
  23. docpilot_ai-0.2.0/src/parsedoc/ai/gemini.py +38 -0
  24. docpilot_ai-0.2.0/src/parsedoc/ai/ollama.py +59 -0
  25. docpilot_ai-0.2.0/src/parsedoc/ai/openai.py +41 -0
  26. docpilot_ai-0.2.0/src/parsedoc/ai/prompts.py +48 -0
  27. docpilot_ai-0.2.0/src/parsedoc/cli.py +226 -0
  28. docpilot_ai-0.2.0/src/parsedoc/core/__init__.py +13 -0
  29. docpilot_ai-0.2.0/src/parsedoc/core/chunking.py +52 -0
  30. docpilot_ai-0.2.0/src/parsedoc/core/config.py +188 -0
  31. docpilot_ai-0.2.0/src/parsedoc/core/detection.py +47 -0
  32. docpilot_ai-0.2.0/src/parsedoc/core/document.py +10 -0
  33. docpilot_ai-0.2.0/src/parsedoc/core/pipeline.py +307 -0
  34. docpilot_ai-0.2.0/src/parsedoc/extraction/__init__.py +25 -0
  35. docpilot_ai-0.2.0/src/parsedoc/extraction/images.py +100 -0
  36. docpilot_ai-0.2.0/src/parsedoc/extraction/layout.py +12 -0
  37. docpilot_ai-0.2.0/src/parsedoc/extraction/quality.py +29 -0
  38. docpilot_ai-0.2.0/src/parsedoc/extraction/tables.py +25 -0
  39. docpilot_ai-0.2.0/src/parsedoc/extraction/text.py +83 -0
  40. docpilot_ai-0.2.0/src/parsedoc/ocr/__init__.py +6 -0
  41. docpilot_ai-0.2.0/src/parsedoc/ocr/base.py +27 -0
  42. docpilot_ai-0.2.0/src/parsedoc/ocr/tesseract.py +44 -0
  43. docpilot_ai-0.2.0/src/parsedoc/parsers/__init__.py +40 -0
  44. docpilot_ai-0.2.0/src/parsedoc/parsers/base.py +56 -0
  45. docpilot_ai-0.2.0/src/parsedoc/parsers/docx.py +71 -0
  46. docpilot_ai-0.2.0/src/parsedoc/parsers/html.py +104 -0
  47. docpilot_ai-0.2.0/src/parsedoc/parsers/image.py +44 -0
  48. docpilot_ai-0.2.0/src/parsedoc/parsers/pdf.py +48 -0
  49. docpilot_ai-0.2.0/src/parsedoc/parsers/pptx.py +39 -0
  50. docpilot_ai-0.2.0/src/parsedoc/parsers/text.py +54 -0
  51. docpilot_ai-0.2.0/src/parsedoc/renderers/__init__.py +33 -0
  52. docpilot_ai-0.2.0/src/parsedoc/renderers/html.py +59 -0
  53. docpilot_ai-0.2.0/src/parsedoc/renderers/json.py +10 -0
  54. docpilot_ai-0.2.0/src/parsedoc/renderers/markdown.py +66 -0
  55. docpilot_ai-0.2.0/src/parsedoc/renderers/text.py +21 -0
  56. docpilot_ai-0.2.0/src/parsedoc/schema/__init__.py +12 -0
  57. docpilot_ai-0.2.0/src/parsedoc/schema/document.py +46 -0
  58. docpilot_ai-0.2.0/src/parsedoc/schema/validation.py +35 -0
  59. docpilot_ai-0.2.0/src/parsedoc/tests/AYANTRA TECHNOLOGIES - Official Commercial Pricing & Service Engagement Framework.docx +0 -0
  60. docpilot_ai-0.2.0/src/parsedoc/tests/Ayantra - Quotation Quotation-AY-QT-2026-001.docx +0 -0
  61. docpilot_ai-0.2.0/src/parsedoc/tests/Presentation-1.pptx +0 -0
  62. docpilot_ai-0.2.0/src/parsedoc/utils/__init__.py +23 -0
  63. docpilot_ai-0.2.0/src/parsedoc/utils/filesystem.py +35 -0
  64. docpilot_ai-0.2.0/src/parsedoc/utils/logging.py +31 -0
  65. docpilot_ai-0.2.0/src/parsedoc/utils/timing.py +39 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(grep -E \"\\\\.\\(py|md|toml|json\\)$\")",
5
+ "Bash(python *)"
6
+ ]
7
+ }
8
+ }
@@ -0,0 +1,287 @@
1
+ Metadata-Version: 2.5
2
+ Name: docpilot-ai
3
+ Version: 0.2.0
4
+ Summary: AI-powered local-first CLI that converts documents into clean, structured, AI-ready Markdown
5
+ Author-email: Anuj Paroha <dev.77anuj77@gmail.com>
6
+ License: MIT
7
+ Keywords: ai,cli,document-conversion,docx,llm,markdown,pdf,pptx
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: beautifulsoup4>=4.12
21
+ Requires-Dist: httpx>=0.27
22
+ Requires-Dist: openai>=1.0
23
+ Requires-Dist: pillow>=10.0
24
+ Requires-Dist: pydantic>=2.5
25
+ Requires-Dist: pymupdf>=1.23
26
+ Requires-Dist: pytesseract>=0.3.10
27
+ Requires-Dist: python-docx>=1.1
28
+ Requires-Dist: python-pptx>=0.6
29
+ Requires-Dist: rich>=13.0
30
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
31
+ Requires-Dist: typer>=0.12
32
+ Provides-Extra: dev
33
+ Requires-Dist: mypy>=1.10; extra == 'dev'
34
+ Requires-Dist: pytest>=8.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.5; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # ParseDoc
39
+
40
+ > Document → AI → Markdown. A local-first CLI that converts documents into clean, structured, AI-ready Markdown.
41
+
42
+ ParseDoc turns PDFs, Word docs, PowerPoint decks, HTML pages, plain text, and images into well-structured Markdown. Libraries extract the raw facts, an optional AI model understands the structure, and a deterministic renderer produces the final output. It works **fully offline** (local rule-based structuring) and can optionally use an AI provider for smarter structuring.
43
+
44
+ ---
45
+
46
+ ## Features
47
+
48
+ - **Local-first**: conversion works with no AI provider configured (deterministic fallback).
49
+ - **Multi-format input**: PDF, DOCX, PPTX, HTML, TXT/MD, and images (PNG/JPG) via OCR.
50
+ - **AI structuring** (optional): `local`, `ai`, or `hybrid` modes.
51
+ - **Pluggable AI providers**: OpenAI-compatible (vLLM/LM Studio), OpenAI, Google Gemini, and Ollama (native, no SDK needed).
52
+ - **Image extraction**: pull embedded images from DOCX into an assets folder.
53
+ - **OCR**: Tesseract-backed text extraction for scanned PDFs and images.
54
+ - **Multiple output formats**: `markdown` (default), `json`, `html`, `text`.
55
+
56
+ ---
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ git clone <repo-url>
62
+ cd parsedoc
63
+ pip install -e .
64
+ ```
65
+
66
+ This installs the `parsedoc` command. (Requires Python 3.10+.)
67
+
68
+ ### Optional dependencies
69
+
70
+ | Capability | What you need |
71
+ |------------|---------------|
72
+ | PDF parsing | `pymupdf` (fitz) |
73
+ | DOCX / PPTX | `python-docx`, `python-pptx` |
74
+ | HTML | `beautifulsoup4`, `lxml` |
75
+ | OCR | [Tesseract](https://github.com/tesseract-ocr/tesseract) installed + `pytesseract` |
76
+
77
+ ---
78
+
79
+ ## CLI Usage
80
+
81
+ The CLI is built with Typer. Run `parsedoc --help` for the full list.
82
+
83
+ ### Commands
84
+
85
+ | Command | Purpose |
86
+ |---------|---------|
87
+ | `parsedoc convert` | Convert a single document to Markdown. |
88
+ | `parsedoc batch` | Convert every matching file in a directory. |
89
+ | `parsedoc inspect` | Inspect a document's extracted structure (JSON or summary). |
90
+ | `parsedoc config` | View or edit the TOML configuration (`list`, `set`, `reset`). |
91
+ | `parsedoc version` | Print version + banner. |
92
+
93
+ ### `convert`
94
+
95
+ ```bash
96
+ parsedoc convert INPUT_FILE \
97
+ --output out.md \
98
+ --format markdown \
99
+ --mode hybrid \
100
+ --ai-provider ollama \
101
+ --model qwen3 \
102
+ --extract-images
103
+ ```
104
+
105
+ **Options**
106
+
107
+ | Flag | Default | Description |
108
+ |------|---------|-------------|
109
+ | `--output`, `-o` | stdout | Write output to a file. |
110
+ | `--format`, `-f` | `markdown` | `markdown`, `json`, `html`, `text`. |
111
+ | `--mode`, `-m` | `hybrid` | `local`, `ai`, or `hybrid`. |
112
+ | `--ai-provider` | config | Override the AI provider. |
113
+ | `--model` | config | Override the model name. |
114
+ | `--temperature` | `0.2` | AI sampling temperature. |
115
+ | `--max-tokens` | `2048` | Max AI tokens. |
116
+ | `--ocr` | off | Force OCR processing. |
117
+ | `--extract-images` | off | Extract embedded images (DOCX) into `<stem>_assets/`. |
118
+ | `--quiet` / `--verbose` | off | Logging verbosity. |
119
+
120
+ ### `batch`
121
+
122
+ ```bash
123
+ parsedoc batch ./docs --pattern "*.docx" --format markdown --extract-images
124
+ ```
125
+
126
+ ### `inspect`
127
+
128
+ ```bash
129
+ parsedoc inspect INPUT_FILE --format json # full extracted structure
130
+ parsedoc inspect INPUT_FILE --format summary # blocks / title / format
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Configuration
136
+
137
+ ParseDoc stores config as TOML (default location: `~/.config/parsedoc/config.toml`, or via `default_config_path()`). You can edit it directly or use the CLI.
138
+
139
+ ```bash
140
+ parsedoc config list
141
+ parsedoc config set --key ai_provider --value ollama
142
+ parsedoc config set --key model --value qwen3
143
+ parsedoc config reset
144
+ ```
145
+
146
+ ### Environment variables
147
+
148
+ These override the TOML/config values at runtime:
149
+
150
+ | Variable | Maps to |
151
+ |----------|---------|
152
+ | `PARSEDOC_AI_PROVIDER` | `ai_provider` |
153
+ | `PARSEDOC_BASE_URL` | `base_url` |
154
+ | `PARSEDOC_MODEL` | `model` |
155
+ | `PARSEDOC_API_KEY` | `api_key` |
156
+ | `PARSEDOC_OCR_LANGUAGE` | `ocr_language` |
157
+
158
+ ---
159
+
160
+ ## Integrating AI Providers
161
+
162
+ ParseDoc supports four provider types, selected via `--ai-provider` (CLI), the `ai.provider` config key, or `PARSEDOC_AI_PROVIDER`.
163
+
164
+ | Provider value | Use case |
165
+ |----------------|----------|
166
+ | `openai-compatible` | Any OpenAI-compatible endpoint (vLLM, LM Studio, local servers, OpenRouter, etc.) |
167
+ | `openai` | OpenAI's hosted API |
168
+ | `gemini` | Google Gemini API |
169
+ | `ollama` | Ollama running locally (native HTTP, no SDK required) |
170
+
171
+ Provider is chosen by the factory in `parsedoc/ai/base.py:build_provider`.
172
+
173
+ ### 1. OpenAI-compatible (default)
174
+
175
+ This is the default and works with most self-hosted / drop-in OpenAI servers.
176
+
177
+ ```bash
178
+ export PARSEDOC_BASE_URL="http://localhost:11434/v1" # e.g. Ollama's OpenAI shim
179
+ export PARSEDOC_API_KEY="local" # or your real key
180
+ export PARSEDOC_MODEL="qwen3"
181
+ parsedoc config set --key ai_provider --value openai-compatible
182
+ ```
183
+
184
+ TOML equivalent (`~/.config/parsedoc/config.toml`):
185
+
186
+ ```toml
187
+ [ai]
188
+ enabled = true
189
+ provider = "openai-compatible"
190
+ base_url = "http://localhost:11434/v1"
191
+ model = "qwen3"
192
+ api_key = "local"
193
+ temperature = 0.2
194
+ max_tokens = 4096
195
+ ```
196
+
197
+ ### 2. OpenAI (hosted)
198
+
199
+ ```bash
200
+ export PARSEDOC_BASE_URL="https://api.openai.com/v1"
201
+ export PARSEDOC_API_KEY="sk-..."
202
+ export PARSEDOC_MODEL="gpt-4o-mini"
203
+ parsedoc config set --key ai_provider --value openai
204
+ ```
205
+
206
+ ### 3. Google Gemini
207
+
208
+ ```bash
209
+ export PARSEDOC_API_KEY="AIza..."
210
+ export PARSEDOC_MODEL="gemini-1.5-flash"
211
+ parsedoc config set --key ai_provider --value gemini
212
+ ```
213
+
214
+ > Note: the Gemini provider uses its own endpoint; `base_url` is optional and falls back to the Google Generative Language API.
215
+
216
+ ### 4. Ollama (native)
217
+
218
+ No Python SDK required — ParseDoc talks to Ollama over HTTP using the standard library.
219
+
220
+ ```bash
221
+ export PARSEDOC_BASE_URL="http://localhost:11434" # Ollama root, not the /v1 shim
222
+ export PARSEDOC_MODEL="qwen3"
223
+ parsedoc config set --key ai_provider --value ollama
224
+ ```
225
+
226
+ Then make sure the model is pulled:
227
+
228
+ ```bash
229
+ ollama pull qwen3
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Processing Modes
235
+
236
+ | Mode | Behavior |
237
+ |------|----------|
238
+ | `local` | Pure rule-based structuring. No network calls. Fast and private. |
239
+ | `ai` | Structures content using the configured AI provider. |
240
+ | `hybrid` | Uses AI when available, falls back to local structuring on failure. |
241
+
242
+ Set via `--mode` on `convert`/`batch`, or `output`/`ai` config sections (the `provider`/`enabled` keys).
243
+
244
+ ---
245
+
246
+ ## Supported Input Formats
247
+
248
+ | Format | Extensions |
249
+ |--------|-----------|
250
+ | PDF | `.pdf` |
251
+ | Word | `.docx` |
252
+ | PowerPoint | `.pptx` |
253
+ | HTML | `.html`, `.htm` |
254
+ | Text / Markdown | `.txt`, `.md`, `.markdown` |
255
+ | Images | `.png`, `.jpg`, `.jpeg` (OCR) |
256
+
257
+ Check support before converting:
258
+
259
+ ```bash
260
+ python -c "from parsedoc.core.detection import is_supported; print(is_supported('file.docx'))"
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Using ParseDoc as a Library
266
+
267
+ ```python
268
+ from parsedoc.core.config import Config
269
+ from parsedoc.core.pipeline import Pipeline
270
+
271
+ config = Config().load_from_file()
272
+ pipeline = Pipeline(config)
273
+
274
+ markdown = pipeline.process(
275
+ "report.docx",
276
+ output_format="markdown",
277
+ mode="hybrid",
278
+ extract_images=True,
279
+ output_path="report.md",
280
+ )
281
+ ```
282
+
283
+ ---
284
+
285
+ ## License
286
+
287
+ See repository for license details.
@@ -0,0 +1,250 @@
1
+ # ParseDoc
2
+
3
+ > Document → AI → Markdown. A local-first CLI that converts documents into clean, structured, AI-ready Markdown.
4
+
5
+ ParseDoc turns PDFs, Word docs, PowerPoint decks, HTML pages, plain text, and images into well-structured Markdown. Libraries extract the raw facts, an optional AI model understands the structure, and a deterministic renderer produces the final output. It works **fully offline** (local rule-based structuring) and can optionally use an AI provider for smarter structuring.
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - **Local-first**: conversion works with no AI provider configured (deterministic fallback).
12
+ - **Multi-format input**: PDF, DOCX, PPTX, HTML, TXT/MD, and images (PNG/JPG) via OCR.
13
+ - **AI structuring** (optional): `local`, `ai`, or `hybrid` modes.
14
+ - **Pluggable AI providers**: OpenAI-compatible (vLLM/LM Studio), OpenAI, Google Gemini, and Ollama (native, no SDK needed).
15
+ - **Image extraction**: pull embedded images from DOCX into an assets folder.
16
+ - **OCR**: Tesseract-backed text extraction for scanned PDFs and images.
17
+ - **Multiple output formats**: `markdown` (default), `json`, `html`, `text`.
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ git clone <repo-url>
25
+ cd parsedoc
26
+ pip install -e .
27
+ ```
28
+
29
+ This installs the `parsedoc` command. (Requires Python 3.10+.)
30
+
31
+ ### Optional dependencies
32
+
33
+ | Capability | What you need |
34
+ |------------|---------------|
35
+ | PDF parsing | `pymupdf` (fitz) |
36
+ | DOCX / PPTX | `python-docx`, `python-pptx` |
37
+ | HTML | `beautifulsoup4`, `lxml` |
38
+ | OCR | [Tesseract](https://github.com/tesseract-ocr/tesseract) installed + `pytesseract` |
39
+
40
+ ---
41
+
42
+ ## CLI Usage
43
+
44
+ The CLI is built with Typer. Run `parsedoc --help` for the full list.
45
+
46
+ ### Commands
47
+
48
+ | Command | Purpose |
49
+ |---------|---------|
50
+ | `parsedoc convert` | Convert a single document to Markdown. |
51
+ | `parsedoc batch` | Convert every matching file in a directory. |
52
+ | `parsedoc inspect` | Inspect a document's extracted structure (JSON or summary). |
53
+ | `parsedoc config` | View or edit the TOML configuration (`list`, `set`, `reset`). |
54
+ | `parsedoc version` | Print version + banner. |
55
+
56
+ ### `convert`
57
+
58
+ ```bash
59
+ parsedoc convert INPUT_FILE \
60
+ --output out.md \
61
+ --format markdown \
62
+ --mode hybrid \
63
+ --ai-provider ollama \
64
+ --model qwen3 \
65
+ --extract-images
66
+ ```
67
+
68
+ **Options**
69
+
70
+ | Flag | Default | Description |
71
+ |------|---------|-------------|
72
+ | `--output`, `-o` | stdout | Write output to a file. |
73
+ | `--format`, `-f` | `markdown` | `markdown`, `json`, `html`, `text`. |
74
+ | `--mode`, `-m` | `hybrid` | `local`, `ai`, or `hybrid`. |
75
+ | `--ai-provider` | config | Override the AI provider. |
76
+ | `--model` | config | Override the model name. |
77
+ | `--temperature` | `0.2` | AI sampling temperature. |
78
+ | `--max-tokens` | `2048` | Max AI tokens. |
79
+ | `--ocr` | off | Force OCR processing. |
80
+ | `--extract-images` | off | Extract embedded images (DOCX) into `<stem>_assets/`. |
81
+ | `--quiet` / `--verbose` | off | Logging verbosity. |
82
+
83
+ ### `batch`
84
+
85
+ ```bash
86
+ parsedoc batch ./docs --pattern "*.docx" --format markdown --extract-images
87
+ ```
88
+
89
+ ### `inspect`
90
+
91
+ ```bash
92
+ parsedoc inspect INPUT_FILE --format json # full extracted structure
93
+ parsedoc inspect INPUT_FILE --format summary # blocks / title / format
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Configuration
99
+
100
+ ParseDoc stores config as TOML (default location: `~/.config/parsedoc/config.toml`, or via `default_config_path()`). You can edit it directly or use the CLI.
101
+
102
+ ```bash
103
+ parsedoc config list
104
+ parsedoc config set --key ai_provider --value ollama
105
+ parsedoc config set --key model --value qwen3
106
+ parsedoc config reset
107
+ ```
108
+
109
+ ### Environment variables
110
+
111
+ These override the TOML/config values at runtime:
112
+
113
+ | Variable | Maps to |
114
+ |----------|---------|
115
+ | `PARSEDOC_AI_PROVIDER` | `ai_provider` |
116
+ | `PARSEDOC_BASE_URL` | `base_url` |
117
+ | `PARSEDOC_MODEL` | `model` |
118
+ | `PARSEDOC_API_KEY` | `api_key` |
119
+ | `PARSEDOC_OCR_LANGUAGE` | `ocr_language` |
120
+
121
+ ---
122
+
123
+ ## Integrating AI Providers
124
+
125
+ ParseDoc supports four provider types, selected via `--ai-provider` (CLI), the `ai.provider` config key, or `PARSEDOC_AI_PROVIDER`.
126
+
127
+ | Provider value | Use case |
128
+ |----------------|----------|
129
+ | `openai-compatible` | Any OpenAI-compatible endpoint (vLLM, LM Studio, local servers, OpenRouter, etc.) |
130
+ | `openai` | OpenAI's hosted API |
131
+ | `gemini` | Google Gemini API |
132
+ | `ollama` | Ollama running locally (native HTTP, no SDK required) |
133
+
134
+ Provider is chosen by the factory in `parsedoc/ai/base.py:build_provider`.
135
+
136
+ ### 1. OpenAI-compatible (default)
137
+
138
+ This is the default and works with most self-hosted / drop-in OpenAI servers.
139
+
140
+ ```bash
141
+ export PARSEDOC_BASE_URL="http://localhost:11434/v1" # e.g. Ollama's OpenAI shim
142
+ export PARSEDOC_API_KEY="local" # or your real key
143
+ export PARSEDOC_MODEL="qwen3"
144
+ parsedoc config set --key ai_provider --value openai-compatible
145
+ ```
146
+
147
+ TOML equivalent (`~/.config/parsedoc/config.toml`):
148
+
149
+ ```toml
150
+ [ai]
151
+ enabled = true
152
+ provider = "openai-compatible"
153
+ base_url = "http://localhost:11434/v1"
154
+ model = "qwen3"
155
+ api_key = "local"
156
+ temperature = 0.2
157
+ max_tokens = 4096
158
+ ```
159
+
160
+ ### 2. OpenAI (hosted)
161
+
162
+ ```bash
163
+ export PARSEDOC_BASE_URL="https://api.openai.com/v1"
164
+ export PARSEDOC_API_KEY="sk-..."
165
+ export PARSEDOC_MODEL="gpt-4o-mini"
166
+ parsedoc config set --key ai_provider --value openai
167
+ ```
168
+
169
+ ### 3. Google Gemini
170
+
171
+ ```bash
172
+ export PARSEDOC_API_KEY="AIza..."
173
+ export PARSEDOC_MODEL="gemini-1.5-flash"
174
+ parsedoc config set --key ai_provider --value gemini
175
+ ```
176
+
177
+ > Note: the Gemini provider uses its own endpoint; `base_url` is optional and falls back to the Google Generative Language API.
178
+
179
+ ### 4. Ollama (native)
180
+
181
+ No Python SDK required — ParseDoc talks to Ollama over HTTP using the standard library.
182
+
183
+ ```bash
184
+ export PARSEDOC_BASE_URL="http://localhost:11434" # Ollama root, not the /v1 shim
185
+ export PARSEDOC_MODEL="qwen3"
186
+ parsedoc config set --key ai_provider --value ollama
187
+ ```
188
+
189
+ Then make sure the model is pulled:
190
+
191
+ ```bash
192
+ ollama pull qwen3
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Processing Modes
198
+
199
+ | Mode | Behavior |
200
+ |------|----------|
201
+ | `local` | Pure rule-based structuring. No network calls. Fast and private. |
202
+ | `ai` | Structures content using the configured AI provider. |
203
+ | `hybrid` | Uses AI when available, falls back to local structuring on failure. |
204
+
205
+ Set via `--mode` on `convert`/`batch`, or `output`/`ai` config sections (the `provider`/`enabled` keys).
206
+
207
+ ---
208
+
209
+ ## Supported Input Formats
210
+
211
+ | Format | Extensions |
212
+ |--------|-----------|
213
+ | PDF | `.pdf` |
214
+ | Word | `.docx` |
215
+ | PowerPoint | `.pptx` |
216
+ | HTML | `.html`, `.htm` |
217
+ | Text / Markdown | `.txt`, `.md`, `.markdown` |
218
+ | Images | `.png`, `.jpg`, `.jpeg` (OCR) |
219
+
220
+ Check support before converting:
221
+
222
+ ```bash
223
+ python -c "from parsedoc.core.detection import is_supported; print(is_supported('file.docx'))"
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Using ParseDoc as a Library
229
+
230
+ ```python
231
+ from parsedoc.core.config import Config
232
+ from parsedoc.core.pipeline import Pipeline
233
+
234
+ config = Config().load_from_file()
235
+ pipeline = Pipeline(config)
236
+
237
+ markdown = pipeline.process(
238
+ "report.docx",
239
+ output_format="markdown",
240
+ mode="hybrid",
241
+ extract_images=True,
242
+ output_path="report.md",
243
+ )
244
+ ```
245
+
246
+ ---
247
+
248
+ ## License
249
+
250
+ See repository for license details.
@@ -0,0 +1,28 @@
1
+
2
+ ____ ____
3
+ | _ \ __ _ _ __ ___ ___| _ \ ___ ___
4
+ | |_) / _` | '__/ __|/ _ \ | | |/ _ \ / __|
5
+ | __/ (_| | | \__ \ __/ |_| | (_) | (__
6
+ |_| \__,_|_| |___/\___|____/ \___/ \___|
7
+
8
+ ParseDoc - Document → AI → Markdown
9
+ Version 0.2.0
10
+
11
+ 2026-08-24 20:42:08,282 - parsedoc - INFO - Extracting PPTX content with python-pptx
12
+ 2026-08-24 20:42:51,031 - httpx2 - INFO - HTTP Request: POST https://api.xkiro.com/v1/chat/completions "HTTP/1.1 200 OK"
13
+ 2026-08-24 20:44:01,974 - httpx2 - INFO - HTTP Request: POST https://api.xkiro.com/v1/chat/completions "HTTP/1.1 502 Bad Gateway"
14
+ 2026-08-24 20:44:01,975 - openai._base_client - INFO - Retrying request to /chat/completions in 60.000000 seconds
15
+ 2026-08-24 20:45:05,506 - httpx2 - INFO - HTTP Request: POST https://api.xkiro.com/v1/chat/completions "HTTP/1.1 409 Conflict"
16
+ 2026-08-24 20:45:05,507 - openai._base_client - INFO - Retrying request to /chat/completions in 0.755471 seconds
17
+ 2026-08-24 20:45:09,404 - httpx2 - INFO - HTTP Request: POST https://api.xkiro.com/v1/chat/completions "HTTP/1.1 409 Conflict"
18
+ 2026-08-24 20:45:09,405 - parsedoc - WARNING - AI processing failed (Error code: 409 - {'error': {'message': 'A duplicate request is already being processed — please try again.', 'type': 'server_error', 'code': 'internal_error'}}); using local structure.
19
+ ✓ Created: out_test/presentation.md
20
+ Summary
21
+ ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
22
+ ┃ Metric ┃ Value ┃
23
+ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
24
+ │ input_file │ src/parsedoc/tests/Presentation-1.pptx │
25
+ │ output_format │ markdown │
26
+ │ processing_mode │ hybrid │
27
+ │ status │ success │
28
+ └─────────────────┴────────────────────────────────────────┘