paive-agents 0.0.1__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.
- paive_agents-0.0.1/PKG-INFO +317 -0
- paive_agents-0.0.1/README.md +299 -0
- paive_agents-0.0.1/pyproject.toml +30 -0
- paive_agents-0.0.1/setup.cfg +4 -0
- paive_agents-0.0.1/src/paive_agents/__init__.py +39 -0
- paive_agents-0.0.1/src/paive_agents/_analysis.py +21 -0
- paive_agents-0.0.1/src/paive_agents/_payload.py +79 -0
- paive_agents-0.0.1/src/paive_agents/async_client.py +481 -0
- paive_agents-0.0.1/src/paive_agents/client.py +482 -0
- paive_agents-0.0.1/src/paive_agents/exceptions.py +91 -0
- paive_agents-0.0.1/src/paive_agents/models.py +75 -0
- paive_agents-0.0.1/src/paive_agents.egg-info/PKG-INFO +317 -0
- paive_agents-0.0.1/src/paive_agents.egg-info/SOURCES.txt +15 -0
- paive_agents-0.0.1/src/paive_agents.egg-info/dependency_links.txt +1 -0
- paive_agents-0.0.1/src/paive_agents.egg-info/requires.txt +2 -0
- paive_agents-0.0.1/src/paive_agents.egg-info/top_level.txt +1 -0
- paive_agents-0.0.1/tests/test_sdk.py +508 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: paive-agents
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Official PAIVE API SDK for patent intelligence reports in PDF, Word, and text
|
|
5
|
+
Author: PAIVE
|
|
6
|
+
Maintainer: PAIVE
|
|
7
|
+
License: LicenseRef-Proprietary
|
|
8
|
+
Project-URL: Homepage, https://paive.patentelligence.ai
|
|
9
|
+
Keywords: paive,patents,patent intelligence,api,sdk,reports
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: requests>=2.28
|
|
17
|
+
Requires-Dist: httpx>=0.24
|
|
18
|
+
|
|
19
|
+
# PAIVE Python API library
|
|
20
|
+
|
|
21
|
+
The official PAIVE Python library provides access to the PAIVE REST API from
|
|
22
|
+
Python 3.8+ applications. The library offers synchronous and asynchronous
|
|
23
|
+
clients for patent intelligence report generation, with support for patent
|
|
24
|
+
number submissions, PDF uploads, configurable analysis parameters, and
|
|
25
|
+
automatic downloads in PDF, DOCX, and TXT formats.
|
|
26
|
+
|
|
27
|
+
Access to the API requires a PAIVE API key.
|
|
28
|
+
|
|
29
|
+
[PAIVE](https://paive.patentelligence.ai) | [PyPI](https://pypi.org/project/paive-agents/)
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Requires Python 3.8 or later.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install paive-agents
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To update an existing installation:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install --upgrade paive-agents
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API key
|
|
46
|
+
|
|
47
|
+
Obtain a PAIVE API key from your PAIVE account or the PAIVE team. Your account
|
|
48
|
+
must have report generation enabled, permission for the selected report, and
|
|
49
|
+
available report credits.
|
|
50
|
+
|
|
51
|
+
The SDK connects automatically to the hosted PAIVE API over HTTPS.
|
|
52
|
+
|
|
53
|
+
Set your key in the terminal where you will run your Python script.
|
|
54
|
+
|
|
55
|
+
**Windows (PowerShell):**
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
$env:PAIVE_API_KEY = "YOUR_PAIVE_API_KEY"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**macOS or Linux:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
export PAIVE_API_KEY="YOUR_PAIVE_API_KEY"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
Save the following as `generate_report.py`:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import os
|
|
73
|
+
|
|
74
|
+
from paive_agents import Client
|
|
75
|
+
|
|
76
|
+
client = Client(api_key=os.environ["PAIVE_API_KEY"])
|
|
77
|
+
|
|
78
|
+
report = client.generate_report(
|
|
79
|
+
patent_id="US11604988B2",
|
|
80
|
+
patent_type="non-regulated",
|
|
81
|
+
output_dir="paive_reports",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
for file_type, path in report.files.items():
|
|
85
|
+
print(f"{file_type.upper()} report saved to: {path}")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Run it with:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
python generate_report.py
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`generate_report()` waits for report generation to finish and downloads the
|
|
95
|
+
requested files before returning. The example generates an IP Brief with all
|
|
96
|
+
three analysis levels set to `High`.
|
|
97
|
+
|
|
98
|
+
PDF, DOCX, and TXT are requested by default. The SDK creates `paive_reports`
|
|
99
|
+
when the completed files are available. A relative output folder is resolved
|
|
100
|
+
from the directory where you run the script.
|
|
101
|
+
|
|
102
|
+
`report.files` maps each downloaded format to its local file path. You can also
|
|
103
|
+
access individual paths using `report.pdf_file`, `report.docx_file`, and
|
|
104
|
+
`report.txt_file`.
|
|
105
|
+
|
|
106
|
+
## Report options
|
|
107
|
+
|
|
108
|
+
| Report | `report_type` |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| IP Brief (default) | `brief_IP_decision_support_intelligence` |
|
|
111
|
+
| IP 360 without valuation | `ip_360_no_valuation_intelligence_strategic_guide` |
|
|
112
|
+
|
|
113
|
+
To generate IP 360 without valuation, select its report type:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
report = client.generate_report(
|
|
117
|
+
patent_id="US11604988B2",
|
|
118
|
+
patent_type="non-regulated",
|
|
119
|
+
report_type="ip_360_no_valuation_intelligence_strategic_guide",
|
|
120
|
+
output_dir="paive_reports",
|
|
121
|
+
)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Access to each report depends on your PAIVE account permissions.
|
|
125
|
+
|
|
126
|
+
## Inputs and parameters
|
|
127
|
+
|
|
128
|
+
Provide exactly one of `patent_id` or `pdf_path`, together with `patent_type`.
|
|
129
|
+
|
|
130
|
+
| Parameter | Description | Default |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| `patent_id` | Patent number, such as `US11604988B2`. Use this or `pdf_path`. | None |
|
|
133
|
+
| `pdf_path` | Path to a patent PDF on your computer. Use this or `patent_id`. | None |
|
|
134
|
+
| `patent_type` | Product category: `non-regulated` or `regulated`. | Required |
|
|
135
|
+
| `report_type` | One of the report identifiers above. | IP Brief |
|
|
136
|
+
| `tech_sector` | Optional technology sector; use an exact sector name available in PAIVE. | None |
|
|
137
|
+
| `clp_analysis` | CLP analysis depth. | `High` |
|
|
138
|
+
| `market_analysis` | Market analysis depth. | `High` |
|
|
139
|
+
| `licensing_analysis` | Licensing analysis depth. | `High` |
|
|
140
|
+
| `output_type` | One format or a list of formats: `pdf`, `docx`, `txt`. | All three |
|
|
141
|
+
| `output_dir` | Folder for downloaded report files. | `generated_reports` |
|
|
142
|
+
|
|
143
|
+
### Analysis depth
|
|
144
|
+
|
|
145
|
+
Each analysis parameter accepts these values:
|
|
146
|
+
|
|
147
|
+
| Value | Depth |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `Low` | Focused analysis |
|
|
150
|
+
| `Medium` | Standard analysis |
|
|
151
|
+
| `Medium-high` | Expanded analysis |
|
|
152
|
+
| `High` | Full analysis |
|
|
153
|
+
|
|
154
|
+
For example:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
report = client.generate_report(
|
|
158
|
+
patent_id="US11604988B2",
|
|
159
|
+
patent_type="non-regulated",
|
|
160
|
+
clp_analysis="Medium",
|
|
161
|
+
market_analysis="High",
|
|
162
|
+
licensing_analysis="Medium-high",
|
|
163
|
+
output_type=["pdf", "docx"],
|
|
164
|
+
output_dir="paive_reports",
|
|
165
|
+
)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Upload a patent PDF
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
report = client.generate_report(
|
|
172
|
+
pdf_path="patent.pdf",
|
|
173
|
+
patent_type="non-regulated",
|
|
174
|
+
output_dir="paive_reports",
|
|
175
|
+
)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Optional questionnaire context
|
|
179
|
+
|
|
180
|
+
You can include business and technology context, such as:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
report = client.generate_report(
|
|
184
|
+
patent_id="US11604988B2",
|
|
185
|
+
patent_type="non-regulated",
|
|
186
|
+
role="Founder/Operator",
|
|
187
|
+
trl_level="TRL 5-6 (Prototype/Lab Validation)",
|
|
188
|
+
output_dir="paive_reports",
|
|
189
|
+
)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Questionnaire selections must use PAIVE's predefined choices. Invalid answers
|
|
193
|
+
return a validation error identifying the affected fields.
|
|
194
|
+
|
|
195
|
+
Some selections require related answers:
|
|
196
|
+
|
|
197
|
+
- `traction_type="customer_discovery"` requires `customer_discovery`,
|
|
198
|
+
`pilots_trials`, and `industry_interest`.
|
|
199
|
+
- `traction_type="rpp"` requires `rpp_stage` and `rpp_deal`.
|
|
200
|
+
- `infringement_suspected="Yes"` or `"Possibly"` requires `suspicion_triggers`.
|
|
201
|
+
|
|
202
|
+
## Track progress
|
|
203
|
+
|
|
204
|
+
Use `on_progress` to display status while the report is being generated:
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
def show_progress(job):
|
|
208
|
+
print(f"{job.status}: {job.current_factor}/{job.total_factors}")
|
|
209
|
+
|
|
210
|
+
report = client.generate_report(
|
|
211
|
+
patent_id="US11604988B2",
|
|
212
|
+
patent_type="non-regulated",
|
|
213
|
+
output_dir="paive_reports",
|
|
214
|
+
on_progress=show_progress,
|
|
215
|
+
)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Generation time depends on the report and analysis depth. The default overall
|
|
219
|
+
waiting limit is 40 minutes. For a longer waiting limit, set `timeout` in seconds
|
|
220
|
+
when creating the client:
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
client = Client(api_key=os.environ["PAIVE_API_KEY"], timeout=7200)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Asynchronous usage
|
|
227
|
+
|
|
228
|
+
Use `AsyncClient` in asynchronous Python applications:
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
import asyncio
|
|
232
|
+
import os
|
|
233
|
+
|
|
234
|
+
from paive_agents import AsyncClient
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
async def main():
|
|
238
|
+
client = AsyncClient(api_key=os.environ["PAIVE_API_KEY"])
|
|
239
|
+
report = await client.generate_report(
|
|
240
|
+
patent_id="US11604988B2",
|
|
241
|
+
patent_type="non-regulated",
|
|
242
|
+
output_dir="paive_reports",
|
|
243
|
+
)
|
|
244
|
+
for file_type, path in report.files.items():
|
|
245
|
+
print(f"{file_type.upper()} report saved to: {path}")
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
if __name__ == "__main__":
|
|
249
|
+
asyncio.run(main())
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Errors and troubleshooting
|
|
253
|
+
|
|
254
|
+
API and connection errors inherit from `paive_agents.PaiveError`. They expose
|
|
255
|
+
`status_code` and `response_body` when available.
|
|
256
|
+
|
|
257
|
+
| Error | What to check |
|
|
258
|
+
| --- | --- |
|
|
259
|
+
| `AuthenticationError` | Your PAIVE API key is valid and active. |
|
|
260
|
+
| `PermissionDeniedError` | Your account has generation access and permission for the selected report. |
|
|
261
|
+
| `InvalidRequestError` | Inputs, questionnaire choices, and available report credits; inspect the error details. |
|
|
262
|
+
| `RateLimitError` | Your account's usage limits; follow the API error details before retrying. |
|
|
263
|
+
| `APIConnectionError` | Your internet connection and service availability. |
|
|
264
|
+
| `ServerError` | PAIVE service availability; retain the error details for support. |
|
|
265
|
+
| `ReportJobFailedError` | The report could not be completed; inspect the error details. |
|
|
266
|
+
| `ReportJobCancelledError` | The report was cancelled. |
|
|
267
|
+
| `ReportJobTimeoutError` | The waiting limit expired; the report may still be processing. |
|
|
268
|
+
|
|
269
|
+
For example:
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
from paive_agents import PaiveError
|
|
273
|
+
|
|
274
|
+
try:
|
|
275
|
+
report = client.generate_report(
|
|
276
|
+
patent_id="US11604988B2",
|
|
277
|
+
patent_type="non-regulated",
|
|
278
|
+
output_dir="paive_reports",
|
|
279
|
+
)
|
|
280
|
+
except PaiveError as error:
|
|
281
|
+
print(f"PAIVE request failed: {error}")
|
|
282
|
+
print(f"Status: {error.status_code}")
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Advanced report jobs
|
|
286
|
+
|
|
287
|
+
For applications that manage report jobs separately, submit a report and retain
|
|
288
|
+
its job ID:
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
job = client.submit_report(
|
|
292
|
+
patent_id="US11604988B2",
|
|
293
|
+
patent_type="non-regulated",
|
|
294
|
+
)
|
|
295
|
+
print(job.id)
|
|
296
|
+
|
|
297
|
+
current = client.get_report_job(job.id)
|
|
298
|
+
print(current.status)
|
|
299
|
+
|
|
300
|
+
# Wait for completion, or cancel the job if needed:
|
|
301
|
+
# completed = client.wait_for_report(job.id)
|
|
302
|
+
# client.cancel_report(job.id)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
These methods return job information. `generate_report()` handles waiting and
|
|
306
|
+
automatic file downloads for you.
|
|
307
|
+
|
|
308
|
+
A report continues processing on PAIVE if the client's connection is interrupted.
|
|
309
|
+
For retries of the same report request, supply the same `idempotency_key` to
|
|
310
|
+
retrieve the existing job and download its files when complete. Use a new key
|
|
311
|
+
when requesting a new report.
|
|
312
|
+
|
|
313
|
+
## Account access
|
|
314
|
+
|
|
315
|
+
Visit [PAIVE](https://paive.patentelligence.ai) for access to the product. Obtain
|
|
316
|
+
API keys and confirm report permissions and credits through your PAIVE account
|
|
317
|
+
or the PAIVE team.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# PAIVE Python API library
|
|
2
|
+
|
|
3
|
+
The official PAIVE Python library provides access to the PAIVE REST API from
|
|
4
|
+
Python 3.8+ applications. The library offers synchronous and asynchronous
|
|
5
|
+
clients for patent intelligence report generation, with support for patent
|
|
6
|
+
number submissions, PDF uploads, configurable analysis parameters, and
|
|
7
|
+
automatic downloads in PDF, DOCX, and TXT formats.
|
|
8
|
+
|
|
9
|
+
Access to the API requires a PAIVE API key.
|
|
10
|
+
|
|
11
|
+
[PAIVE](https://paive.patentelligence.ai) | [PyPI](https://pypi.org/project/paive-agents/)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Requires Python 3.8 or later.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install paive-agents
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To update an existing installation:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install --upgrade paive-agents
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API key
|
|
28
|
+
|
|
29
|
+
Obtain a PAIVE API key from your PAIVE account or the PAIVE team. Your account
|
|
30
|
+
must have report generation enabled, permission for the selected report, and
|
|
31
|
+
available report credits.
|
|
32
|
+
|
|
33
|
+
The SDK connects automatically to the hosted PAIVE API over HTTPS.
|
|
34
|
+
|
|
35
|
+
Set your key in the terminal where you will run your Python script.
|
|
36
|
+
|
|
37
|
+
**Windows (PowerShell):**
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
$env:PAIVE_API_KEY = "YOUR_PAIVE_API_KEY"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**macOS or Linux:**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export PAIVE_API_KEY="YOUR_PAIVE_API_KEY"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
Save the following as `generate_report.py`:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import os
|
|
55
|
+
|
|
56
|
+
from paive_agents import Client
|
|
57
|
+
|
|
58
|
+
client = Client(api_key=os.environ["PAIVE_API_KEY"])
|
|
59
|
+
|
|
60
|
+
report = client.generate_report(
|
|
61
|
+
patent_id="US11604988B2",
|
|
62
|
+
patent_type="non-regulated",
|
|
63
|
+
output_dir="paive_reports",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
for file_type, path in report.files.items():
|
|
67
|
+
print(f"{file_type.upper()} report saved to: {path}")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Run it with:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python generate_report.py
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`generate_report()` waits for report generation to finish and downloads the
|
|
77
|
+
requested files before returning. The example generates an IP Brief with all
|
|
78
|
+
three analysis levels set to `High`.
|
|
79
|
+
|
|
80
|
+
PDF, DOCX, and TXT are requested by default. The SDK creates `paive_reports`
|
|
81
|
+
when the completed files are available. A relative output folder is resolved
|
|
82
|
+
from the directory where you run the script.
|
|
83
|
+
|
|
84
|
+
`report.files` maps each downloaded format to its local file path. You can also
|
|
85
|
+
access individual paths using `report.pdf_file`, `report.docx_file`, and
|
|
86
|
+
`report.txt_file`.
|
|
87
|
+
|
|
88
|
+
## Report options
|
|
89
|
+
|
|
90
|
+
| Report | `report_type` |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| IP Brief (default) | `brief_IP_decision_support_intelligence` |
|
|
93
|
+
| IP 360 without valuation | `ip_360_no_valuation_intelligence_strategic_guide` |
|
|
94
|
+
|
|
95
|
+
To generate IP 360 without valuation, select its report type:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
report = client.generate_report(
|
|
99
|
+
patent_id="US11604988B2",
|
|
100
|
+
patent_type="non-regulated",
|
|
101
|
+
report_type="ip_360_no_valuation_intelligence_strategic_guide",
|
|
102
|
+
output_dir="paive_reports",
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Access to each report depends on your PAIVE account permissions.
|
|
107
|
+
|
|
108
|
+
## Inputs and parameters
|
|
109
|
+
|
|
110
|
+
Provide exactly one of `patent_id` or `pdf_path`, together with `patent_type`.
|
|
111
|
+
|
|
112
|
+
| Parameter | Description | Default |
|
|
113
|
+
| --- | --- | --- |
|
|
114
|
+
| `patent_id` | Patent number, such as `US11604988B2`. Use this or `pdf_path`. | None |
|
|
115
|
+
| `pdf_path` | Path to a patent PDF on your computer. Use this or `patent_id`. | None |
|
|
116
|
+
| `patent_type` | Product category: `non-regulated` or `regulated`. | Required |
|
|
117
|
+
| `report_type` | One of the report identifiers above. | IP Brief |
|
|
118
|
+
| `tech_sector` | Optional technology sector; use an exact sector name available in PAIVE. | None |
|
|
119
|
+
| `clp_analysis` | CLP analysis depth. | `High` |
|
|
120
|
+
| `market_analysis` | Market analysis depth. | `High` |
|
|
121
|
+
| `licensing_analysis` | Licensing analysis depth. | `High` |
|
|
122
|
+
| `output_type` | One format or a list of formats: `pdf`, `docx`, `txt`. | All three |
|
|
123
|
+
| `output_dir` | Folder for downloaded report files. | `generated_reports` |
|
|
124
|
+
|
|
125
|
+
### Analysis depth
|
|
126
|
+
|
|
127
|
+
Each analysis parameter accepts these values:
|
|
128
|
+
|
|
129
|
+
| Value | Depth |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| `Low` | Focused analysis |
|
|
132
|
+
| `Medium` | Standard analysis |
|
|
133
|
+
| `Medium-high` | Expanded analysis |
|
|
134
|
+
| `High` | Full analysis |
|
|
135
|
+
|
|
136
|
+
For example:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
report = client.generate_report(
|
|
140
|
+
patent_id="US11604988B2",
|
|
141
|
+
patent_type="non-regulated",
|
|
142
|
+
clp_analysis="Medium",
|
|
143
|
+
market_analysis="High",
|
|
144
|
+
licensing_analysis="Medium-high",
|
|
145
|
+
output_type=["pdf", "docx"],
|
|
146
|
+
output_dir="paive_reports",
|
|
147
|
+
)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Upload a patent PDF
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
report = client.generate_report(
|
|
154
|
+
pdf_path="patent.pdf",
|
|
155
|
+
patent_type="non-regulated",
|
|
156
|
+
output_dir="paive_reports",
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Optional questionnaire context
|
|
161
|
+
|
|
162
|
+
You can include business and technology context, such as:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
report = client.generate_report(
|
|
166
|
+
patent_id="US11604988B2",
|
|
167
|
+
patent_type="non-regulated",
|
|
168
|
+
role="Founder/Operator",
|
|
169
|
+
trl_level="TRL 5-6 (Prototype/Lab Validation)",
|
|
170
|
+
output_dir="paive_reports",
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Questionnaire selections must use PAIVE's predefined choices. Invalid answers
|
|
175
|
+
return a validation error identifying the affected fields.
|
|
176
|
+
|
|
177
|
+
Some selections require related answers:
|
|
178
|
+
|
|
179
|
+
- `traction_type="customer_discovery"` requires `customer_discovery`,
|
|
180
|
+
`pilots_trials`, and `industry_interest`.
|
|
181
|
+
- `traction_type="rpp"` requires `rpp_stage` and `rpp_deal`.
|
|
182
|
+
- `infringement_suspected="Yes"` or `"Possibly"` requires `suspicion_triggers`.
|
|
183
|
+
|
|
184
|
+
## Track progress
|
|
185
|
+
|
|
186
|
+
Use `on_progress` to display status while the report is being generated:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
def show_progress(job):
|
|
190
|
+
print(f"{job.status}: {job.current_factor}/{job.total_factors}")
|
|
191
|
+
|
|
192
|
+
report = client.generate_report(
|
|
193
|
+
patent_id="US11604988B2",
|
|
194
|
+
patent_type="non-regulated",
|
|
195
|
+
output_dir="paive_reports",
|
|
196
|
+
on_progress=show_progress,
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Generation time depends on the report and analysis depth. The default overall
|
|
201
|
+
waiting limit is 40 minutes. For a longer waiting limit, set `timeout` in seconds
|
|
202
|
+
when creating the client:
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
client = Client(api_key=os.environ["PAIVE_API_KEY"], timeout=7200)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Asynchronous usage
|
|
209
|
+
|
|
210
|
+
Use `AsyncClient` in asynchronous Python applications:
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
import asyncio
|
|
214
|
+
import os
|
|
215
|
+
|
|
216
|
+
from paive_agents import AsyncClient
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
async def main():
|
|
220
|
+
client = AsyncClient(api_key=os.environ["PAIVE_API_KEY"])
|
|
221
|
+
report = await client.generate_report(
|
|
222
|
+
patent_id="US11604988B2",
|
|
223
|
+
patent_type="non-regulated",
|
|
224
|
+
output_dir="paive_reports",
|
|
225
|
+
)
|
|
226
|
+
for file_type, path in report.files.items():
|
|
227
|
+
print(f"{file_type.upper()} report saved to: {path}")
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
if __name__ == "__main__":
|
|
231
|
+
asyncio.run(main())
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Errors and troubleshooting
|
|
235
|
+
|
|
236
|
+
API and connection errors inherit from `paive_agents.PaiveError`. They expose
|
|
237
|
+
`status_code` and `response_body` when available.
|
|
238
|
+
|
|
239
|
+
| Error | What to check |
|
|
240
|
+
| --- | --- |
|
|
241
|
+
| `AuthenticationError` | Your PAIVE API key is valid and active. |
|
|
242
|
+
| `PermissionDeniedError` | Your account has generation access and permission for the selected report. |
|
|
243
|
+
| `InvalidRequestError` | Inputs, questionnaire choices, and available report credits; inspect the error details. |
|
|
244
|
+
| `RateLimitError` | Your account's usage limits; follow the API error details before retrying. |
|
|
245
|
+
| `APIConnectionError` | Your internet connection and service availability. |
|
|
246
|
+
| `ServerError` | PAIVE service availability; retain the error details for support. |
|
|
247
|
+
| `ReportJobFailedError` | The report could not be completed; inspect the error details. |
|
|
248
|
+
| `ReportJobCancelledError` | The report was cancelled. |
|
|
249
|
+
| `ReportJobTimeoutError` | The waiting limit expired; the report may still be processing. |
|
|
250
|
+
|
|
251
|
+
For example:
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
from paive_agents import PaiveError
|
|
255
|
+
|
|
256
|
+
try:
|
|
257
|
+
report = client.generate_report(
|
|
258
|
+
patent_id="US11604988B2",
|
|
259
|
+
patent_type="non-regulated",
|
|
260
|
+
output_dir="paive_reports",
|
|
261
|
+
)
|
|
262
|
+
except PaiveError as error:
|
|
263
|
+
print(f"PAIVE request failed: {error}")
|
|
264
|
+
print(f"Status: {error.status_code}")
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Advanced report jobs
|
|
268
|
+
|
|
269
|
+
For applications that manage report jobs separately, submit a report and retain
|
|
270
|
+
its job ID:
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
job = client.submit_report(
|
|
274
|
+
patent_id="US11604988B2",
|
|
275
|
+
patent_type="non-regulated",
|
|
276
|
+
)
|
|
277
|
+
print(job.id)
|
|
278
|
+
|
|
279
|
+
current = client.get_report_job(job.id)
|
|
280
|
+
print(current.status)
|
|
281
|
+
|
|
282
|
+
# Wait for completion, or cancel the job if needed:
|
|
283
|
+
# completed = client.wait_for_report(job.id)
|
|
284
|
+
# client.cancel_report(job.id)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
These methods return job information. `generate_report()` handles waiting and
|
|
288
|
+
automatic file downloads for you.
|
|
289
|
+
|
|
290
|
+
A report continues processing on PAIVE if the client's connection is interrupted.
|
|
291
|
+
For retries of the same report request, supply the same `idempotency_key` to
|
|
292
|
+
retrieve the existing job and download its files when complete. Use a new key
|
|
293
|
+
when requesting a new report.
|
|
294
|
+
|
|
295
|
+
## Account access
|
|
296
|
+
|
|
297
|
+
Visit [PAIVE](https://paive.patentelligence.ai) for access to the product. Obtain
|
|
298
|
+
API keys and confirm report permissions and credits through your PAIVE account
|
|
299
|
+
or the PAIVE team.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "paive-agents"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Official PAIVE API SDK for patent intelligence reports in PDF, Word, and text"
|
|
9
|
+
authors = [{name = "PAIVE"}]
|
|
10
|
+
maintainers = [{name = "PAIVE"}]
|
|
11
|
+
keywords = ["paive", "patents", "patent intelligence", "api", "sdk", "reports"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
readme = "README.md"
|
|
19
|
+
requires-python = ">=3.8"
|
|
20
|
+
license = {text = "LicenseRef-Proprietary"}
|
|
21
|
+
dependencies = [
|
|
22
|
+
"requests>=2.28",
|
|
23
|
+
"httpx>=0.24",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://paive.patentelligence.ai"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from .async_client import AsyncClient
|
|
2
|
+
from .client import Client, DEFAULT_BASE_URL
|
|
3
|
+
from .exceptions import (
|
|
4
|
+
APIConnectionError,
|
|
5
|
+
AuthenticationError,
|
|
6
|
+
InvalidRequestError,
|
|
7
|
+
PaiveError,
|
|
8
|
+
PermissionDeniedError,
|
|
9
|
+
RateLimitError,
|
|
10
|
+
ReportJobCancelledError,
|
|
11
|
+
ReportJobError,
|
|
12
|
+
ReportJobFailedError,
|
|
13
|
+
ReportJobTimeoutError,
|
|
14
|
+
ServerError,
|
|
15
|
+
)
|
|
16
|
+
from .models import Report, ReportJob
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
__version__ = "0.0.1"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"Client",
|
|
24
|
+
"AsyncClient",
|
|
25
|
+
"Report",
|
|
26
|
+
"ReportJob",
|
|
27
|
+
"DEFAULT_BASE_URL",
|
|
28
|
+
"PaiveError",
|
|
29
|
+
"AuthenticationError",
|
|
30
|
+
"PermissionDeniedError",
|
|
31
|
+
"InvalidRequestError",
|
|
32
|
+
"RateLimitError",
|
|
33
|
+
"ServerError",
|
|
34
|
+
"APIConnectionError",
|
|
35
|
+
"ReportJobError",
|
|
36
|
+
"ReportJobFailedError",
|
|
37
|
+
"ReportJobCancelledError",
|
|
38
|
+
"ReportJobTimeoutError",
|
|
39
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
ANALYSIS_LEVELS = ("Low", "Medium", "Medium-high", "High")
|
|
2
|
+
|
|
3
|
+
_CANONICAL_LEVELS = {
|
|
4
|
+
level.lower(): level
|
|
5
|
+
for level in ANALYSIS_LEVELS
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def normalize_analysis_level(value, argument_name):
|
|
10
|
+
"""Validate an SDK analysis level and return its canonical spelling."""
|
|
11
|
+
if value is None or not str(value).strip():
|
|
12
|
+
return "High"
|
|
13
|
+
|
|
14
|
+
normalized = str(value).strip().lower()
|
|
15
|
+
try:
|
|
16
|
+
return _CANONICAL_LEVELS[normalized]
|
|
17
|
+
except KeyError as exc:
|
|
18
|
+
raise ValueError(
|
|
19
|
+
f"{argument_name} must be one of: "
|
|
20
|
+
f"{', '.join(ANALYSIS_LEVELS)}"
|
|
21
|
+
) from exc
|