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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsonllm_client-0.2.0.tar.gz.
File metadata
- Download URL: jsonllm_client-0.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdec23489e46623564f8994b13027e98c86279970ef0fdbac7989f68f690af12
|
|
| MD5 |
b32711f94da3024547d4e832c6514dd8
|
|
| BLAKE2b-256 |
5ba30fd74c0e9d62fbc0c06e0e0dfb833db79614e05cc3bdf8fac8d65b737722
|
File details
Details for the file jsonllm_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: jsonllm_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
587e1c83099de67dacd8552dca485f5e2e22f2cae780e2553fd584b3e52eebfe
|
|
| MD5 |
998c0111fce2f05373691c28c31bb934
|
|
| BLAKE2b-256 |
8ac7f14f24c9cd8be5ebcdbc893d68d6401d81e6a708b82bd905e83b7f713fc4
|