Package: ezllm
ezllm-pythonThe goal of EzLLM is to provide the simplest interface for creating LLM based applicationsEzLLM simplifies the process ofFile parsingStorageRetrievalLLM optimizationLLM output parsingHome Page---Docs---Developer Consolefor more informationQuick StartInstallpipinstallezllmAuthenticate the SDKgo to the API keys page in the developer dashboardcreate an API keysave the API key and API secret to a.envfileEZLLM_KEY=abcEZLLM_SECRET=xyzby saving it to a .env file, ezllm will authenticate itselfalternatively you can pass the key and secret to ezllm to create a clientfromezllmimportClientclient=Client(key='...',secret='...')Upload Documentsimportezllm# orfromezllmimportCollectioncol=ezllm.Collection("documentation")# Upload a single filefile=open('./file.pdf','r')awaitcol.upload(file)# Upload by pathawaitcol.upload(path='./file.pdf')# Orawaitcol.upload(path='./file.pdf',name="My File Name",type='pdf')Retrieve Relevant Documentsfor more information on document retrievalclick hereresponse=col.search('search query').get()print(response)# OutputSearchResponse(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 .docsprint(response.docs)# OutputResponseDocs(docs=[SearchResponseDoc(name="Test File"SubDocs=1)])fordocinresponse.docs:print(doc)# OutputSearchResponseDoc(name="Test File"SubDocs=1)Run Methods against a Retrievalfromezllm.methodsimportQAMethodcol.search('search query').run(QAMethod(questions=["Is this document relevant to my research in XYZ"]))# OutputQAMethodResponse(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 docsdoc_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}]))...]))Teststests 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 hereto run tests, you need to provide a .env file with the following values.EZLLM_ACCESS_KEY=access_keyEZLLM_SECRET=secretEZLLM_API_URL=https://api.ezllm.io# optionalEZLLM_RUN_URL=https://run.ezllm.io# optionalDeploypipshowezllm# 1. Buildpython3setup.pysdistbdist_wheel2.# Install## localpip3install--upgradedist/ezllm-0.1-py3-none-any.whl## test-pypipip3install--index-urlhttps://test.pypi.org/simple/ezllm## pypipip3installezllm## Uninstall (necessary to test each version)pip3uninstallezllm3.# Upload## test-pypipython3-mtwineupload--repositorytestpypidist/*## pypipython3-mtwineuploaddist/*