ezllm-python
The goal of EzLLM is to provide the simplest interface for creating LLM based applications
EzLLM simplifies the process of
- File parsing
- Storage
- Retrieval
- LLM optimization
- LLM output parsing
Home Page --- Docs --- Developer Console
for more information
Quick Start
Install
pip install ezllm
Authenticate the SDK
- go to the API keys page in the developer dashboard
- create an API key
- save the API key and API secret to a
.envfile
EZLLM_KEY=abc
EZLLM_SECRET=xyz
by saving it to a .env file, ezllm will authenticate itself
alternatively you can pass the key and secret to ezllm to create a client
from ezllm import Client
client = Client(key='...', secret='...')
Upload Documents
import ezllm
# or
from ezllm import Collection
col = ezllm.Collection("documentation")
# Upload a single file
file = open('./file.pdf', 'r')
await col.upload(file)
# Upload by path
await col.upload(path='./file.pdf')
# Or
await col.upload(path='./file.pdf', name="My File Name", type='pdf')
Retrieve Relevant Documents
for more information on document retrieval click here
response = col.search('search query').get()
print(response)
# Output
SearchResponse(
costs=ResponseCosts(
total_cost=10.0,
costs=[
ResponseCost(
cost=10,
date='2024-01-12T05:38:08.266074',
step='retrieve',
usage=1,
limitType='search',
limitId='search',
desc=None,
reportedCost=None
)
]
)
doc_groups=SearchDocOutputGroups(
groups=[
SearchDocOutputGroup(
id="collection_id",
type="collection",
data=SearchResponseDocs(
docs=[
SearchResponseDoc(
name="Test File",
SubDocs=1
)
]
)
)
]
)
)
# it's heavily nested from the aggregation step
# so you can reference all of the underlying docs with .docs
print(response.docs)
# Output
ResponseDocs(
docs=[
SearchResponseDoc(
name="Test File"
SubDocs=1
)
]
)
for doc in response.docs:
print(doc)
# Output
SearchResponseDoc(
name="Test File"
SubDocs=1
)
Run Methods against a Retrieval
from ezllm.methods import QAMethod
col.search('search query').run(QAMethod(questions=["Is this document relevant to my research in XYZ"]))
# Output
QAMethodResponse(
costs=ResponseCosts(
total_cost=0.08994,
costs=[
ResponseCost(cost=0.01061, date='2023-12-27T18:11:18.722257', step='method', usage=835, limitType='llm', limitId='gpt-4-1106-preview', desc=None, reportedCost=None)
...
]
)
# add the include_docs=True argument to return docs
doc_groups=DocOutputGroups(
groups=[
]
)
output_groups=QAOutputGroups(
groups=[
QAOutputGroup(
type="document"
id="658b4e441f41ead7592562de"
output=QAOutputData(
data=[
{
"question": "Who are the authors?",
"answer": "Sylvain Burns, Joseph Brehaut, Jamie Britton",
"relevant": 100
},
{
"question": "What organizations is this document from?",
"answer": "Journal of Professional Engineering, University of Ottawa",
"relevant": 100
}
]
)
)
...
]
)
)
Tests
tests are located in the /test directory and can be a good resource for understanding how to interact with entities in the SDK.
to run tests, you need to provide a .env file with the following values.
EZLLM_ACCESS_KEY = access_key
EZLLM_SECRET = secret
EZLLM_API_URL = https://api.ezllm.io # optional
EZLLM_RUN_URL = https://run.ezllm.io # optional
Deploy
pip show ezllm
# 1. Build
python3 setup.py sdist bdist_wheel
2. # Install
## local
pip3 install --upgrade dist/ezllm-0.1-py3-none-any.whl
## test-pypi
pip3 install --index-url https://test.pypi.org/simple/ ezllm
## pypi
pip3 install ezllm
## Uninstall (necessary to test each version)
pip3 uninstall ezllm
3. # Upload
## test-pypi
python3 -m twine upload --repository testpypi dist/*
## pypi
python3 -m twine upload dist/*
Metadata
Release files for ezllm 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ezllm-0.1.2.tar.gz | 16.6 kB | Without provenance | Details for ezllm-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ezllm-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for ezllm-0.1.2-py3-none-any.whl |
Total release size: 47.7 kB
Release files / ezllm-0.1.2.tar.gz
| Download URL | ezllm-0.1.2.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7426ae2de9c5baa936f53823c1599ae48ec33b2a0d10dcb234f34e01ddcb945f
|
|
BLAKE2b-256 checksum How to use checksums |
935bba02826a31bf7c9f56b7fe48d427f734f570f9fab8f2baf32c699161509c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / ezllm-0.1.2-py3-none-any.whl
| Download URL | ezllm-0.1.2-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e90185d177ff6fb7c870eaa6896157d1ece2c77ec10a1c9e1df255cd031d12e
|
|
BLAKE2b-256 checksum How to use checksums |
a0eddc38c56aaa12c2c3bb0d97ac9ee36d6d5364b3d9bc4ef3b3164858c592b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for ezllm 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.