File size: 667 Bytes
318db6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from fastapi import APIRouter, Request, FastAPI
from langchain_community.embeddings.ollama import OllamaEmbeddings
import uvicorn
embed_model = OllamaEmbeddings(model="bge-m3")
app = FastAPI(
title="kb",
description="update_kb",
)
kb_router = APIRouter(
prefix="/kb",
tags=["kb"]
)
@kb_router.post("/")
async def update_kb(request: Request):
request = await request.json()
data = request.get("data", [])
collection_name = request.get("collection_name", "")
# print(f"collection_name: {collection_name}")
app.include_router(kb_router)
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8010, loop="asyncio")
|