Skip to main content

Client for JsonLLM API

Project description

JsonLLM client

jsonllm-client is a Python client library for interacting with the JsonLLM API.

JsonLLM allows you to extract structured data from documents.

jsonllm-client allows users to upload documents and delete documents, as well as extract data from said documents.

Installation

jsonllm-client is available on PyPI, so it can be installed easily, e.g. using pip:

pip install jsonllm_client

Initialization

You need to create an API key, which you can do here.

from jsonllm_client import JsonLLM

api_key = "your_api_key_here"
json_llm = JsonLLM(api_key)

Upload document(s)

To upload a document to a project, you need to use the .upload method:

from jsonllm_client import JsonLLM

api_key = "your_api_key_here"
jsonllm = JsonLLM(api_key)

jsonllm.upload("invoice", "/home/ubuntu/Invoice_105274235.pdf")

To upload multiple documents, simply supply multiple paths:

from jsonllm_client import JsonLLM

api_key = "your_api_key_here"
jsonllm = JsonLLM(api_key)

jsonllm.upload("invoice", ["/home/ubuntu/Invoice_13.pdf", "/home/ubuntu/Invoice_91.pdf"])

Add plain text document(s)

To add a document from plain text, use the .add_text method:

from jsonllm_client import JsonLLM

api_key = "your_api_key_here"
jsonllm = JsonLLM(api_key)

jsonllm.add_text("news", "cnn_article.txt", "Tensions rise.")

Extract from document

import json

from jsonllm_client import JsonLLM

api_key = "your_api_key_here"
jsonllm = JsonLLM(api_key)

res = jsonllm.extract(
    project="invoice",
    filename="Invoice_105274235.pdf"
)
print(json.dumps(res, indent=2))
# {
#   "invoice_date": "July 4, 2017",
#   "invoice_id": "105274235",
#   "s3_amount": "0.11",
#   "tax_amount": "0.00",
#   "total_amount": "52.57",
#   "vendor_name": "Amazon Web Services, Inc"
# }

Delete document(s)

To delete a document, use the .delete_document method

from jsonllm_client import JsonLLM

api_key = "your_api_key_here"
jsonllm = JsonLLM(api_key)

jsonllm.delete_document("invoice", "/home/ubuntu/Invoice_105274235.pdf")

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

jsonllm_client-0.6.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonllm_client-0.6.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file jsonllm_client-0.6.0.tar.gz.

File metadata

  • Download URL: jsonllm_client-0.6.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for jsonllm_client-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8c572db63d7912021d74e30d64fd324f3f3aa1a3a9dd00834b6d614d2e39f072
MD5 534cfdf0d6bcb575f3d5ab6bd98a9566
BLAKE2b-256 fb908e1c7850f64a9e61aea36380173105b5ce24d59632ca90efe58dbec2e1bb

See more details on using hashes here.

File details

Details for the file jsonllm_client-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: jsonllm_client-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for jsonllm_client-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a46d5145bdd0a37f80e43061d63cb5d9f8dd0947a1904936e66593af36efc89
MD5 89b35a46b69fa1c92430d4f34948caf1
BLAKE2b-256 dd38cae24569085cfe16b7240cfaa9f63eb9430299722429691d97fc87b7e2e0

See more details on using hashes here.

Supported by

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