qomplement 0.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Qomplement
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: qomplement
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the Qomplement StructDatafy API — extract structured data from documents and fill forms with AI.
5
+ Author-email: Andres Garza <andres@qomplement.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://qomplement.com
8
+ Project-URL: Documentation, https://docs.qomplement.com
9
+ Project-URL: Repository, https://github.com/Qomplement/qomplement-python
10
+ Project-URL: Issues, https://github.com/Qomplement/qomplement-python/issues
11
+ Keywords: qomplement,ocr,document,extraction,pdf,excel,ai
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.28.0
28
+ Dynamic: license-file
29
+
30
+ # qomplement
31
+
32
+ Python SDK for the [Qomplement StructDatafy API](https://docs.qomplement.com) — extract structured data from documents and fill PDF/Excel forms with AI.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install qomplement
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ```python
43
+ from qomplement import Qomplement
44
+
45
+ client = Qomplement("sd_your_api_key")
46
+
47
+ # Extract data from any document
48
+ result = client.extract("invoice.pdf")
49
+ print(result.fields)
50
+ # {'invoice_number': '12345', 'client_name': 'Acme Corp', 'total': '$5,000.00'}
51
+ print(result.tables)
52
+ print(result.document_type) # 'invoice'
53
+ print(result.confidence) # 94
54
+ ```
55
+
56
+ ## Extract
57
+
58
+ ```python
59
+ # Basic extraction
60
+ result = client.extract("document.pdf")
61
+
62
+ # With full detail (entities, summary, primary/secondary entities)
63
+ result = client.extract("document.pdf", detail=True)
64
+ print(result.detail["entities"])
65
+ print(result.detail["summary"])
66
+
67
+ # Guided extraction with schema
68
+ schema = [
69
+ {"name": "invoice_number", "type": "string"},
70
+ {"name": "total_amount", "type": "number"},
71
+ {"name": "vendor_name", "type": "string"},
72
+ ]
73
+ result = client.extract("invoice.pdf", schema=schema)
74
+
75
+ # Extract with text chunking
76
+ result = client.extract("long_document.pdf", chunk_size=1000, chunk_overlap=200)
77
+ for chunk in result.chunks:
78
+ print(chunk["text"])
79
+
80
+ # From bytes
81
+ with open("document.pdf", "rb") as f:
82
+ result = client.extract(f.read(), filename="document.pdf")
83
+ ```
84
+
85
+ ## Fill PDF
86
+
87
+ ```python
88
+ # Fill using source documents (AI extracts and maps fields)
89
+ result = client.fill_pdf(
90
+ "form.pdf",
91
+ source="invoice.pdf",
92
+ )
93
+ result.save("filled_form.pdf")
94
+
95
+ # Fill with natural language instructions
96
+ result = client.fill_pdf(
97
+ "contract.pdf",
98
+ instructions="Fill client name as 'Acme Corporation' and date as January 15, 2024",
99
+ )
100
+ result.save("filled_contract.pdf")
101
+
102
+ # Fill with explicit field mappings
103
+ result = client.fill_pdf(
104
+ "form.pdf",
105
+ field_mappings={"client_name": "Acme Corp", "date": "2024-01-15"},
106
+ )
107
+ result.save("filled_form.pdf")
108
+
109
+ print(f"Filled {result.fields_filled}/{result.fields_total} fields")
110
+ ```
111
+
112
+ ## Fill Excel
113
+
114
+ ```python
115
+ # Fill Excel template from source documents
116
+ result = client.fill_excel(
117
+ "template.xlsx",
118
+ source="invoice.pdf",
119
+ )
120
+ result.save("filled_template.xlsx")
121
+
122
+ # Fill with instructions
123
+ result = client.fill_excel(
124
+ "template.xlsx",
125
+ instructions="Add company name as Acme Corp in the header",
126
+ )
127
+ result.save("filled.xlsx")
128
+ ```
129
+
130
+ ## Async Jobs
131
+
132
+ Large documents (>5 pages) are processed asynchronously. By default, the SDK polls and waits for completion:
133
+
134
+ ```python
135
+ # This automatically waits for completion (default: wait=True)
136
+ result = client.extract("large_document.pdf")
137
+
138
+ # Get a job reference without waiting
139
+ job = client.extract("large_document.pdf", wait=False)
140
+ print(job.id) # job ID
141
+ print(job.status) # 'processing'
142
+
143
+ # Check job status later
144
+ job = client.get_job(job.id)
145
+ if job.status == "completed":
146
+ print(job.result)
147
+
148
+ # List your jobs
149
+ jobs = client.list_jobs(status="completed", limit=10)
150
+ ```
151
+
152
+ ## Usage
153
+
154
+ ```python
155
+ usage = client.usage()
156
+ print(f"Requests: {usage.requests}")
157
+ print(f"Pages processed: {usage.pages_processed}")
158
+
159
+ # Usage for a specific month
160
+ usage = client.usage(period="2026-02")
161
+ ```
162
+
163
+ ## Supported Formats
164
+
165
+ ```python
166
+ formats = client.formats()
167
+ print(formats["total_formats"]) # 33
168
+
169
+ # List available models
170
+ models = client.models()
171
+ for m in models:
172
+ print(f"{m['id']}: {m['description']}")
173
+ ```
174
+
175
+ The API supports 33+ file formats including PDF, DOCX, XLSX, PPTX, CSV, TXT, RTF, images (PNG, JPEG, HEIC, TIFF), and legacy formats (DOC, XLS, PPT).
176
+
177
+ ## Configuration
178
+
179
+ ```python
180
+ # API key from environment variable
181
+ import os
182
+ os.environ["QOMPLEMENT_API_KEY"] = "sd_your_api_key"
183
+ client = Qomplement()
184
+
185
+ # Custom base URL
186
+ client = Qomplement("sd_your_api_key", base_url="https://developer-api-testing.qomplement.com")
187
+
188
+ # Custom timeout and max wait
189
+ client = Qomplement("sd_your_api_key", timeout=120, max_wait=300)
190
+ ```
191
+
192
+ ## Error Handling
193
+
194
+ ```python
195
+ from qomplement import Qomplement, AuthenticationError, RateLimitError, ValidationError
196
+
197
+ client = Qomplement("sd_your_api_key")
198
+
199
+ try:
200
+ result = client.extract("document.pdf")
201
+ except AuthenticationError:
202
+ print("Invalid API key")
203
+ except RateLimitError as e:
204
+ print(f"Rate limited. Retry after {e.retry_after}s")
205
+ except ValidationError as e:
206
+ print(f"Invalid request: {e}")
207
+ ```
208
+
209
+ ## License
210
+
211
+ MIT
@@ -0,0 +1,182 @@
1
+ # qomplement
2
+
3
+ Python SDK for the [Qomplement StructDatafy API](https://docs.qomplement.com) — extract structured data from documents and fill PDF/Excel forms with AI.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install qomplement
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from qomplement import Qomplement
15
+
16
+ client = Qomplement("sd_your_api_key")
17
+
18
+ # Extract data from any document
19
+ result = client.extract("invoice.pdf")
20
+ print(result.fields)
21
+ # {'invoice_number': '12345', 'client_name': 'Acme Corp', 'total': '$5,000.00'}
22
+ print(result.tables)
23
+ print(result.document_type) # 'invoice'
24
+ print(result.confidence) # 94
25
+ ```
26
+
27
+ ## Extract
28
+
29
+ ```python
30
+ # Basic extraction
31
+ result = client.extract("document.pdf")
32
+
33
+ # With full detail (entities, summary, primary/secondary entities)
34
+ result = client.extract("document.pdf", detail=True)
35
+ print(result.detail["entities"])
36
+ print(result.detail["summary"])
37
+
38
+ # Guided extraction with schema
39
+ schema = [
40
+ {"name": "invoice_number", "type": "string"},
41
+ {"name": "total_amount", "type": "number"},
42
+ {"name": "vendor_name", "type": "string"},
43
+ ]
44
+ result = client.extract("invoice.pdf", schema=schema)
45
+
46
+ # Extract with text chunking
47
+ result = client.extract("long_document.pdf", chunk_size=1000, chunk_overlap=200)
48
+ for chunk in result.chunks:
49
+ print(chunk["text"])
50
+
51
+ # From bytes
52
+ with open("document.pdf", "rb") as f:
53
+ result = client.extract(f.read(), filename="document.pdf")
54
+ ```
55
+
56
+ ## Fill PDF
57
+
58
+ ```python
59
+ # Fill using source documents (AI extracts and maps fields)
60
+ result = client.fill_pdf(
61
+ "form.pdf",
62
+ source="invoice.pdf",
63
+ )
64
+ result.save("filled_form.pdf")
65
+
66
+ # Fill with natural language instructions
67
+ result = client.fill_pdf(
68
+ "contract.pdf",
69
+ instructions="Fill client name as 'Acme Corporation' and date as January 15, 2024",
70
+ )
71
+ result.save("filled_contract.pdf")
72
+
73
+ # Fill with explicit field mappings
74
+ result = client.fill_pdf(
75
+ "form.pdf",
76
+ field_mappings={"client_name": "Acme Corp", "date": "2024-01-15"},
77
+ )
78
+ result.save("filled_form.pdf")
79
+
80
+ print(f"Filled {result.fields_filled}/{result.fields_total} fields")
81
+ ```
82
+
83
+ ## Fill Excel
84
+
85
+ ```python
86
+ # Fill Excel template from source documents
87
+ result = client.fill_excel(
88
+ "template.xlsx",
89
+ source="invoice.pdf",
90
+ )
91
+ result.save("filled_template.xlsx")
92
+
93
+ # Fill with instructions
94
+ result = client.fill_excel(
95
+ "template.xlsx",
96
+ instructions="Add company name as Acme Corp in the header",
97
+ )
98
+ result.save("filled.xlsx")
99
+ ```
100
+
101
+ ## Async Jobs
102
+
103
+ Large documents (>5 pages) are processed asynchronously. By default, the SDK polls and waits for completion:
104
+
105
+ ```python
106
+ # This automatically waits for completion (default: wait=True)
107
+ result = client.extract("large_document.pdf")
108
+
109
+ # Get a job reference without waiting
110
+ job = client.extract("large_document.pdf", wait=False)
111
+ print(job.id) # job ID
112
+ print(job.status) # 'processing'
113
+
114
+ # Check job status later
115
+ job = client.get_job(job.id)
116
+ if job.status == "completed":
117
+ print(job.result)
118
+
119
+ # List your jobs
120
+ jobs = client.list_jobs(status="completed", limit=10)
121
+ ```
122
+
123
+ ## Usage
124
+
125
+ ```python
126
+ usage = client.usage()
127
+ print(f"Requests: {usage.requests}")
128
+ print(f"Pages processed: {usage.pages_processed}")
129
+
130
+ # Usage for a specific month
131
+ usage = client.usage(period="2026-02")
132
+ ```
133
+
134
+ ## Supported Formats
135
+
136
+ ```python
137
+ formats = client.formats()
138
+ print(formats["total_formats"]) # 33
139
+
140
+ # List available models
141
+ models = client.models()
142
+ for m in models:
143
+ print(f"{m['id']}: {m['description']}")
144
+ ```
145
+
146
+ The API supports 33+ file formats including PDF, DOCX, XLSX, PPTX, CSV, TXT, RTF, images (PNG, JPEG, HEIC, TIFF), and legacy formats (DOC, XLS, PPT).
147
+
148
+ ## Configuration
149
+
150
+ ```python
151
+ # API key from environment variable
152
+ import os
153
+ os.environ["QOMPLEMENT_API_KEY"] = "sd_your_api_key"
154
+ client = Qomplement()
155
+
156
+ # Custom base URL
157
+ client = Qomplement("sd_your_api_key", base_url="https://developer-api-testing.qomplement.com")
158
+
159
+ # Custom timeout and max wait
160
+ client = Qomplement("sd_your_api_key", timeout=120, max_wait=300)
161
+ ```
162
+
163
+ ## Error Handling
164
+
165
+ ```python
166
+ from qomplement import Qomplement, AuthenticationError, RateLimitError, ValidationError
167
+
168
+ client = Qomplement("sd_your_api_key")
169
+
170
+ try:
171
+ result = client.extract("document.pdf")
172
+ except AuthenticationError:
173
+ print("Invalid API key")
174
+ except RateLimitError as e:
175
+ print(f"Rate limited. Retry after {e.retry_after}s")
176
+ except ValidationError as e:
177
+ print(f"Invalid request: {e}")
178
+ ```
179
+
180
+ ## License
181
+
182
+ MIT
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "qomplement"
7
+ version = "0.1.0"
8
+ description = "Python SDK for the Qomplement StructDatafy API — extract structured data from documents and fill forms with AI."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.8"
12
+ authors = [
13
+ {name = "Andres Garza", email = "andres@qomplement.com"},
14
+ ]
15
+ keywords = ["qomplement", "ocr", "document", "extraction", "pdf", "excel", "ai"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ ]
30
+ dependencies = [
31
+ "requests>=2.28.0",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://qomplement.com"
36
+ Documentation = "https://docs.qomplement.com"
37
+ Repository = "https://github.com/Qomplement/qomplement-python"
38
+ Issues = "https://github.com/Qomplement/qomplement-python/issues"
39
+
40
+ [tool.setuptools.packages.find]
41
+ include = ["qomplement*"]
@@ -0,0 +1,43 @@
1
+ """
2
+ qomplement — Python SDK for the Qomplement StructDatafy API.
3
+
4
+ Extract structured data from documents and fill PDF/Excel forms with AI.
5
+
6
+ Usage:
7
+ from qomplement import Qomplement
8
+
9
+ client = Qomplement("sd_your_api_key")
10
+ result = client.extract("document.pdf")
11
+ print(result.fields)
12
+ """
13
+
14
+ from qomplement.client import Qomplement
15
+ from qomplement.types import (
16
+ ExtractResult,
17
+ FillPDFResult,
18
+ FillExcelResult,
19
+ Job,
20
+ UsageInfo,
21
+ )
22
+ from qomplement.exceptions import (
23
+ QomplementError,
24
+ AuthenticationError,
25
+ RateLimitError,
26
+ NotFoundError,
27
+ ValidationError,
28
+ )
29
+
30
+ __version__ = "0.1.0"
31
+ __all__ = [
32
+ "Qomplement",
33
+ "ExtractResult",
34
+ "FillPDFResult",
35
+ "FillExcelResult",
36
+ "Job",
37
+ "UsageInfo",
38
+ "QomplementError",
39
+ "AuthenticationError",
40
+ "RateLimitError",
41
+ "NotFoundError",
42
+ "ValidationError",
43
+ ]