Enhance your data pipelines with the power of Large Language Models. EzLLM is a developer tool that opens the door to the LLM ecosystem. Automatic webscrapers, natural language data extraction, semantic search and as little as 3 lines of code
Project description
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/*
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 ezllm-0.1.2.tar.gz.
File metadata
- Download URL: ezllm-0.1.2.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7426ae2de9c5baa936f53823c1599ae48ec33b2a0d10dcb234f34e01ddcb945f
|
|
| MD5 |
73d954b71a8bffa1fdc256bb6e22e152
|
|
| BLAKE2b-256 |
935bba02826a31bf7c9f56b7fe48d427f734f570f9fab8f2baf32c699161509c
|
File details
Details for the file ezllm-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ezllm-0.1.2-py3-none-any.whl
- Upload date:
- Size: 31.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e90185d177ff6fb7c870eaa6896157d1ece2c77ec10a1c9e1df255cd031d12e
|
|
| MD5 |
7583f934a1bb6c8eba59518e08c3f59b
|
|
| BLAKE2b-256 |
a0eddc38c56aaa12c2c3bb0d97ac9ee36d6d5364b3d9bc4ef3b3164858c592b4
|