Client to interact with the Pythia API
Project description
pythia-client
This is the client make it easier to interact with our internal Pythia API.
This is still a work in progress
Usage
- Create a connection with client object
from pythia_client.client import APIClient
client = APIClient(url="http://localhost:8000", api_key="api-key")
- Query the knowledge base (ask a question)
filters = {
"operator": "AND",
"conditions": [
{
"field": "meta.source",
"operator": "==",
"value": "Salesforce",
},
],
}
query_response = client.query("Hey how are you", filters=filters)
query_response.model_dump()
- Index new files in the knowledge base
index_response = client.index_files(["path/to/file.pdf"], meta=[{"source": "Salesforce"}], indexation_mode="pypdf")
index_response.model_dump()
# OR
index_response = client.index_files([("file.pdf", file)], meta=[{"source": "Salesforce"}], indexation_mode="pypdf")
index_response.model_dump()
- List documents in the knowledge base (based on filters)
filters = {
"operator": "AND",
"conditions": [
{
"field": "meta.source",
"operator": "==",
"value": "Salesforce",
},
],
}
list_response = client.list_docs(filters=filters)
list_response.model_dump()
- Remove documents from the knowledge base
filters = {
"operator": "AND",
"conditions": [
{
"field": "meta.source",
"operator": "==",
"value": "Salesforce",
},
],
}
remove_response = client.remove_docs(filters=filters)
remove_response.model_dump()
- Get a presigned S3 url to the original document
get_doc_response = client.get_doc_url("s3fd_sample.pdf", page=2)
s3_url = get_doc_response.url
- Extract JSON data from unstructured test.
Currently used to showcase the Email2Case feature.
extract_response = client.extract_json_data("Hello I want to modify the delivery date of order FR73681920")
extract_response.model_dump()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pythia_client-0.0.5.tar.gz
(268.7 kB
view details)
Built Distribution
File details
Details for the file pythia_client-0.0.5.tar.gz
.
File metadata
- Download URL: pythia_client-0.0.5.tar.gz
- Upload date:
- Size: 268.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0fc7f1a15534fd132cdb6f242f9bbd26ef1baaaf0df4a3dc8cfd2b16e88573 |
|
MD5 | 9c3d98a907a91c65e56ee68a6da180c1 |
|
BLAKE2b-256 | 6384f94eb6915212191a0d4e7758dc05534277b911c6fe3daec7e61d9a5f6691 |
File details
Details for the file pythia_client-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: pythia_client-0.0.5-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55a1a6d6697178e584dfaacdd0ca1eeaaadc7d1c03e9935e21444bbf6b944767 |
|
MD5 | b8810089d52823c45496781cf9919744 |
|
BLAKE2b-256 | d95831cf659f418da2568bb4db0cc73b7e1a9bdcddd673149a36a88aa36b80e2 |