Skip to main content

Client to interact with the Pythia API

Reason this release was yanked:

print statement forgotten

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.upload_files(["path/to/file.pdf"], meta=[{"source": "Salesforce"}])
index_response.model_dump()
# OR
index_response = client.upload_files([("file.pdf", file)], meta=[{"source": "Salesforce"}])
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.get_docs_by_filters(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.delete_docs_by_filters(filters=filters)
remove_response.model_dump()
  • Get a presigned S3 url to the original document
get_doc_response = client.get_file_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_structured_data("Hello I want to modify the delivery date of order FR73681920")
extract_response.model_dump()

Project details


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.2.0.tar.gz (272.3 kB view details)

Uploaded Source

Built Distribution

pythia_client-0.2.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file pythia_client-0.2.0.tar.gz.

File metadata

  • Download URL: pythia_client-0.2.0.tar.gz
  • Upload date:
  • Size: 272.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for pythia_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 35171359120c0d121f03a8948a8666610ab4f37c61831b2947291ccfc58e6512
MD5 c8cd6c0ac4b34a7a4c7c9ff8b4141ba5
BLAKE2b-256 cc40de40541f3b7aa595213b065dd9f11e57987b044ec85a68dd2a947e6432b4

See more details on using hashes here.

File details

Details for the file pythia_client-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pythia_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b94f2ba5d37f2c5e8761921d5abd58608b3e03efe6b183445e6f8088721ff13
MD5 66a70a1a10cab83dce8e26f6b4924c97
BLAKE2b-256 2fc7e978ad680a0b8dddf94f0d4b4ec75f965531ba786259a4d10873c419e251

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page