Spaces:
Runtime error
Runtime error
Update app/main.py
Browse files- app/main.py +7 -1
app/main.py
CHANGED
@@ -285,6 +285,8 @@ from langchain.callbacks.base import BaseCallbackHandler
|
|
285 |
from qdrant_client import QdrantClient
|
286 |
from huggingface_hub import hf_hub_download
|
287 |
from contextlib import asynccontextmanager
|
|
|
|
|
288 |
|
289 |
# === CONFIGURATION === #
|
290 |
from llama_cpp import Llama
|
@@ -364,7 +366,11 @@ async def lifespan(app: FastAPI):
|
|
364 |
)
|
365 |
|
366 |
retriever = qdrant_vectorstore.as_retriever(search_kwargs={"k": 3})
|
367 |
-
|
|
|
|
|
|
|
|
|
368 |
|
369 |
logger.info("Model and vector store initialized successfully.")
|
370 |
yield
|
|
|
285 |
from qdrant_client import QdrantClient
|
286 |
from huggingface_hub import hf_hub_download
|
287 |
from contextlib import asynccontextmanager
|
288 |
+
from langchain.chains.combine_documents import RefineDocumentsChain
|
289 |
+
|
290 |
|
291 |
# === CONFIGURATION === #
|
292 |
from llama_cpp import Llama
|
|
|
366 |
)
|
367 |
|
368 |
retriever = qdrant_vectorstore.as_retriever(search_kwargs={"k": 3})
|
369 |
+
|
370 |
+
combine_docs_chain = RefineDocumentsChain.from_llm(llm=llm)
|
371 |
+
qa_chain = RetrievalQA(combine_documents_chain=combine_docs_chain, retriever=retriever)
|
372 |
+
|
373 |
+
# qa_chain = RetrievalQA.from_chain_type(llm=llm, retriever=retriever, chain_type="stuff")
|
374 |
|
375 |
logger.info("Model and vector store initialized successfully.")
|
376 |
yield
|