Skip to main content

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

  1. File parsing
  2. Storage
  3. Retrieval
  4. LLM optimization
  5. LLM output parsing

Home Page --- Docs --- Developer Console

for more information

Quick Start

Install

pip install ezllm

Authenticate the SDK

  1. go to the API keys page in the developer dashboard
  2. create an API key
  3. save the API key and API secret to a .env file
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.

Read more about tests here

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

# to build
python3 setup.py sdist bdist_wheel

# 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
pip3 uninstall ezllm

# Upload
## test-pypi
python3 -m twine upload --repository testpypi dist/*



## pypi

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

ezllm-0.1.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

ezllm-0.1.1-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file ezllm-0.1.1.tar.gz.

File metadata

  • Download URL: ezllm-0.1.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for ezllm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a5ff8ae1f1b9acebeb7f7ecd204becf4b3e621a62e51b8e5a219ee9da31befb9
MD5 6fedbee6372173751128f4886d800147
BLAKE2b-256 e990606daf374b9b99fea29d201a18746f5a145a6607b564d8fab9622c63965b

See more details on using hashes here.

File details

Details for the file ezllm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ezllm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for ezllm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f973a02071637f61dfa0cb438c92f70d59582996aa2c8a659eb3fc94d5863971
MD5 ba98aca4db26dafea7cf97685b7bcae5
BLAKE2b-256 607d3e04c6c47f87e6b44e51b6e192ffe13955fe43f11c7f981fd48929a523c5

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