DEV Community

parmarjatin4911@gmail.com
parmarjatin4911@gmail.com

Posted on

AutoLLM API

AutoLLM API

from autollm import AutoQueryEngine
from llama_index import SimpleDirectoryReader
import uvicorn
from autollm import AutoFastAPI

documents = SimpleDirectoryReader('data').load_data()

query_engine = AutoQueryEngine.from_parameters(
documents = documents
)

app = AutoFastAPI.from_query_engine(query_engine)

@app.get("/")
async def read_query(q: str):
return query_engine.query(q)

if name == "main":
uvicorn.run(app, host="0.0.0.0", port=8000)

Top comments (0)