querymemory 0.1.0__tar.gz → 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.
- {querymemory-0.1.0 → querymemory-0.2.0}/PKG-INFO +3 -3
- {querymemory-0.1.0 → querymemory-0.2.0}/README.md +1 -1
- {querymemory-0.1.0 → querymemory-0.2.0}/pyproject.toml +2 -2
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory.egg-info/PKG-INFO +3 -3
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory_sdk/client.py +71 -0
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory.egg-info/SOURCES.txt +0 -0
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory.egg-info/dependency_links.txt +0 -0
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory.egg-info/requires.txt +0 -0
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory.egg-info/top_level.txt +0 -0
- {querymemory-0.1.0 → querymemory-0.2.0}/querymemory_sdk/__init__.py +0 -0
- {querymemory-0.1.0 → querymemory-0.2.0}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: querymemory
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Official Query Memory SDK for Knowledge, Agent,
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Query Memory SDK for Knowledge, Agent, Web Parsing, and Extraction APIs
|
|
5
5
|
Requires-Python: >=3.9
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Requires-Dist: requests>=2.31.0
|
|
@@ -13,7 +13,7 @@ Official SDK for Query Memory Knowledge, Agent, and Web Parsing APIs.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pip install querymemory
|
|
16
|
+
pip install querymemory
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick Start
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "querymemory"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Official Query Memory SDK for Knowledge, Agent,
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Official Query Memory SDK for Knowledge, Agent, Web Parsing, and Extraction APIs"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
dependencies = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: querymemory
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Official Query Memory SDK for Knowledge, Agent,
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Query Memory SDK for Knowledge, Agent, Web Parsing, and Extraction APIs
|
|
5
5
|
Requires-Python: >=3.9
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Requires-Dist: requests>=2.31.0
|
|
@@ -13,7 +13,7 @@ Official SDK for Query Memory Knowledge, Agent, and Web Parsing APIs.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pip install querymemory
|
|
16
|
+
pip install querymemory
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Quick Start
|
|
@@ -294,6 +294,76 @@ class WebApi:
|
|
|
294
294
|
)
|
|
295
295
|
|
|
296
296
|
|
|
297
|
+
class ExtractionsApi:
|
|
298
|
+
def __init__(self, http: _HttpClient):
|
|
299
|
+
self._http = http
|
|
300
|
+
|
|
301
|
+
def list_templates(self) -> Dict[str, Any]:
|
|
302
|
+
return self._http.request("GET", "/api/v1/extractions/templates", auth_mode="auto")
|
|
303
|
+
|
|
304
|
+
def get_template(self, template_id: str) -> Dict[str, Any]:
|
|
305
|
+
return self._http.request("GET", f"/api/v1/extractions/templates/{template_id}", auth_mode="auto")
|
|
306
|
+
|
|
307
|
+
def create_template(
|
|
308
|
+
self,
|
|
309
|
+
*,
|
|
310
|
+
name: str,
|
|
311
|
+
description: Optional[str] = None,
|
|
312
|
+
fields: Optional[list[Dict[str, Any]]] = None,
|
|
313
|
+
) -> Dict[str, Any]:
|
|
314
|
+
return self._http.request(
|
|
315
|
+
"POST",
|
|
316
|
+
"/api/v1/extractions/templates",
|
|
317
|
+
auth_mode="auto",
|
|
318
|
+
json_body={
|
|
319
|
+
"name": name,
|
|
320
|
+
"description": description,
|
|
321
|
+
"fields": fields or [],
|
|
322
|
+
},
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
def update_template(self, template_id: str, **payload: Any) -> Dict[str, Any]:
|
|
326
|
+
return self._http.request("PUT", f"/api/v1/extractions/templates/{template_id}", auth_mode="auto", json_body=payload)
|
|
327
|
+
|
|
328
|
+
def delete_template(self, template_id: str) -> Dict[str, Any]:
|
|
329
|
+
return self._http.request("DELETE", f"/api/v1/extractions/templates/{template_id}", auth_mode="auto")
|
|
330
|
+
|
|
331
|
+
def run(self, *, template_id: str, knowledge_id: str) -> Dict[str, Any]:
|
|
332
|
+
return self._http.request(
|
|
333
|
+
"POST",
|
|
334
|
+
"/api/v1/extractions/run",
|
|
335
|
+
auth_mode="auto",
|
|
336
|
+
json_body={"template_id": template_id, "knowledge_id": knowledge_id},
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
def list_jobs(self) -> Dict[str, Any]:
|
|
340
|
+
return self._http.request("GET", "/api/v1/extractions/jobs", auth_mode="auto")
|
|
341
|
+
|
|
342
|
+
def get_job(self, job_id: str) -> Dict[str, Any]:
|
|
343
|
+
return self._http.request("GET", f"/api/v1/extractions/jobs/{job_id}", auth_mode="auto")
|
|
344
|
+
|
|
345
|
+
def wait_for_job(self, job_id: str, *, timeout_sec: int = 300, interval_sec: float = 3.0) -> Dict[str, Any]:
|
|
346
|
+
started = time.time()
|
|
347
|
+
while time.time() - started < timeout_sec:
|
|
348
|
+
result = self.get_job(job_id)
|
|
349
|
+
status = str(result.get("status", "")).lower()
|
|
350
|
+
if status == "completed":
|
|
351
|
+
return result
|
|
352
|
+
if status == "failed":
|
|
353
|
+
raise QueryMemoryError(result.get("error_message", "Extraction job failed"), 500, result)
|
|
354
|
+
time.sleep(interval_sec)
|
|
355
|
+
raise QueryMemoryError(f"Extraction job polling timed out after {timeout_sec}s", 408)
|
|
356
|
+
|
|
357
|
+
def download_csv(self, job_id: str) -> str:
|
|
358
|
+
resp = self._http.session.get(
|
|
359
|
+
f"{self._http.base_url}/api/v1/extractions/jobs/{job_id}/csv",
|
|
360
|
+
headers=self._http._headers(),
|
|
361
|
+
timeout=self._http.timeout,
|
|
362
|
+
)
|
|
363
|
+
resp.raise_for_status()
|
|
364
|
+
return resp.text
|
|
365
|
+
|
|
366
|
+
|
|
297
367
|
class QueryMemoryClient:
|
|
298
368
|
def __init__(
|
|
299
369
|
self,
|
|
@@ -316,3 +386,4 @@ class QueryMemoryClient:
|
|
|
316
386
|
self.knowledge = KnowledgeApi(http)
|
|
317
387
|
self.agents = AgentsApi(http)
|
|
318
388
|
self.web = WebApi(http)
|
|
389
|
+
self.extractions = ExtractionsApi(http)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|