Giter Site home page Giter Site logo

autollm's Introduction

๐Ÿค” why autollm?

Simplify. Unify. Amplify.

Feature AutoLLM LangChain LlamaIndex LiteLLM
100+ LLMs โœ… โœ… โœ… โœ…
Unified API โœ… โŒ โŒ โœ…
20+ Vector Databases โœ… โœ… โœ… โŒ
Cost Calculation (100+ LLMs) โœ… โŒ โŒ โœ…
1-Line RAG LLM Engine โœ… โŒ โŒ โŒ
1-Line FastAPI โœ… โŒ โŒ โŒ

๐Ÿ“ฆ installation

easily install autollm package with pip in Python>=3.8 environment.

pip install autollm

๐ŸŽฏ quickstart

create a query engine in seconds

>>> from autollm import AutoQueryEngine

>>> query_engine = AutoQueryEngine.from_parameters(
>>>   documents: List[llama_index.Documents]
>>> )

>>> response = query_engine.query(
>>>   "Why did SafeVideo AI develop this project?"
>>> )

>>> response.response
"Because they wanted to deploy rag based llm apis in no time!"

convert it to a FastAPI app in 1-line

>>> import uvicorn

>>> from autollm import AutoFastAPI

>>> app = AutoFastAPI.from_query_engine(query_engine)

>>> uvicorn.run(app, host="0.0.0.0", port=8000)
INFO:     Started server process [12345]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://http://0.0.0.0:8000/
๐Ÿ‘‰ advanced usage
>>> from autollm import AutoQueryEngine

>>> query_engine = AutoQueryEngine.from_parameters(
>>>   documents=documents,
>>>   system_prompt= ...
>>>   query_wrapper_prompt= ...
>>>   enable_cost_calculator=True,
>>>   llm_params={"model": "gpt-3.5-turbo"},
>>>   vector_store_params={
>>>     "vector_store_type": "LanceDBVectorStore",
>>>     "uri": "/tmp/lancedb",
>>>     "table_name": "lancedb",
>>>     "nprobs": 20
>>>   },
>>>   service_context_params={"chunk_size": 1024},
>>>   query_engine_params={"similarity_top_k": 10},
>>> )

>>> response = query_engine.query("Who is SafeVideo AI?")

>>> print(response.response)
"A startup that provides self hosted AI API's for companies!"
>>> from autollm import AutoFastAPI

>>> app = AutoFastAPI.from_query_engine(
      query_engine,
      api_title= ...,
      api_description= ...,
      api_version= ...,
      api_term_of_service= ...,
    )

>>> uvicorn.run(app, host="0.0.0.0", port=8000)
INFO:     Started server process [12345]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://http://0.0.0.0:8000/

๐ŸŒŸ features

supports 100+ LLMs

๐Ÿ‘‰ microsoft azure - openai example:
>>> from autollm import AutoLLM

>>> os.environ["AZURE_API_KEY"] = ""
>>> os.environ["AZURE_API_BASE"] = ""
>>> os.environ["AZURE_API_VERSION"] = ""

>>> llm = AutoLLM(model="azure/<your_deployment_name>")
๐Ÿ‘‰ google - vertexai example
>>> from autollm import AutoLLM

>>> os.environ["VERTEXAI_PROJECT"] = "hardy-device-38811"  # Your Project ID`
>>> os.environ["VERTEXAI_LOCATION"] = "us-central1"  # Your Location

>>> llm = AutoLLM(model="text-bison@001")
๐Ÿ‘‰ aws bedrock - claude v2 example
>>> from autollm import AutoLLM

>>> os.environ["AWS_ACCESS_KEY_ID"] = ""
>>> os.environ["AWS_SECRET_ACCESS_KEY"] = ""
>>> os.environ["AWS_REGION_NAME"] = ""

>>> llm = AutoLLM(model="anthropic.claude-v2")

supports 20+ VectorDBs

๐ŸŒŸPro Tip: autollm defaults to lancedb as the vector store: it's setup-free, serverless, and 100x more cost-effective!

๐Ÿ‘‰ default - lancedb example
>>> from autollm import AutoVectorStoreIndex

>>> vector_store_index = AutoVectorStoreIndex.from_defaults(
>>>     documents=documents
>>> )

automated cost calculation for 100+ LLMs

>>> from autollm import AutoServiceContext

>>> service_context = AutoServiceContext(enable_cost_calculation=True)

# Example verbose output after query
Embedding Token Usage: 7
LLM Prompt Token Usage: 1482
LLM Completion Token Usage: 47
LLM Total Token Cost: $0.002317

create FastAPI App in 1-Line

๐Ÿ‘‰ example
>>> from autollm import AutoFastAPI

>>> app = AutoFastAPI.from_config(config_path, env_path)

Here, config and env should be replaced by your configuration and environment file paths.

After creating your FastAPI app, run the following command in your terminal to get it up and running:

uvicorn main:app

๐Ÿ”„ migration from llama-index

switching from Llama-Index? We've got you covered.

๐Ÿ‘‰ easy migration
>>> from llama_index import StorageContext, ServiceContext, VectorStoreIndex
>>> from llama_index.vectorstores import LanceDBVectorStore

>>> from autollm import AutoQueryEngine

>>> vector_store = LanceDBVectorStore(uri="/tmp/lancedb")
>>> storage_context = StorageContext.from_defaults(vector_store=vector_store)
>>> index = VectorStoreIndex.from_documents(documents=documents)
>>> service_context = ServiceContext.from_defaults()

>>> query_engine = AutoQueryEngine.from_instances(index, service_context)

โ“ FAQ

Q: Can I use this for commercial projects?

A: Yes, AutoLLM is licensed under GNU Affero General Public License (AGPL 3.0), which allows for commercial use under certain conditions. Contact us for more information.


roadmap

our roadmap outlines upcoming features and integrations to make autollm the most extensible and powerful base package for large language model applications.

  • 1-line Gradio app creation and deployment

  • Budget based email notification

  • Automated LLM evaluation

  • Add more quickstart apps on pdf-chat, documentation-chat, academic-paper-analysis, patent-analysis and more!


๐Ÿ“œ license

autollm is available under the GNU Affero General Public License (AGPL 3.0).


๐Ÿ“ž contact

for more information, support, or questions, please contact:


๐ŸŒŸ contributing

love autollm? star the repo or contribute and help us make it even better! see our contributing guidelines for more information.


follow us for more!

autollm's People

Contributors

seeknndestroy avatar fcakyon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.