Lanarky is an open-source framework to deploy LLM applications in production. It is built on top of FastAPI and comes with batteries included.
- supports LangChain
- simple gradio chatbot UI for fast prototyping
See Roadmap for upcoming features.
There are great low-code/no-code solutions in the open source to deploy your LLM projects. However, most of them are opinionated in terms of cloud or deployment code. This project aims to provide users with a cloud-agnostic and deployment-agnostic solution which can be easily integrated into existing backend infrastructures.
The library is available on PyPI and can be installed via pip
.
pip install lanarky
You can find the full documentation at https://lanarky.readthedocs.io/en/latest/.
from dotenv import load_dotenv
from fastapi import FastAPI
from langchain import ConversationChain
from langchain.chat_models import ChatOpenAI
from pydantic import BaseModel
from lanarky.responses import StreamingResponse
load_dotenv()
app = FastAPI()
class Request(BaseModel):
query: str
@app.post("/chat")
async def chat(request: Request) -> StreamingResponse:
chain = ConversationChain(llm=ChatOpenAI(temperature=0, streaming=True), verbose=True)
return StreamingResponse.from_chain(chain, request.query, media_type="text/event-stream")
See examples/
for list of available demo examples.
Create a .env
file using .env.sample
and add your OpenAI API key to it
before running the examples.
- Add support for LangChain
- Add Gradio UI for fast prototyping
- Add SQL database integration
- Add support for Guardrails
- Add support for LlamaIndex
- Add GPTCache integration
Contributions are more than welcome! If you have an idea for a new feature or want to help improve lanarky, please create an issue or submit a pull request on GitHub.
See CONTRIBUTING.md for more information.
The library is released under the MIT License.