Spaces:
Runtime error
Runtime error
Update app/main.py
Browse files- app/main.py +4 -6
app/main.py
CHANGED
@@ -285,8 +285,6 @@ 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 |
-
from langchain.chains.combine_documents import RefineDocumentsChain
|
289 |
-
|
290 |
|
291 |
# === CONFIGURATION === #
|
292 |
from llama_cpp import Llama
|
@@ -346,7 +344,7 @@ async def lifespan(app: FastAPI):
|
|
346 |
model_path=model_path,
|
347 |
temperature=0.3,
|
348 |
max_tokens=200,
|
349 |
-
n_ctx=
|
350 |
top_p=0.9,
|
351 |
top_k=40,
|
352 |
n_threads=1,
|
@@ -367,10 +365,10 @@ async def lifespan(app: FastAPI):
|
|
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 |
-
|
374 |
|
375 |
logger.info("Model and vector store initialized successfully.")
|
376 |
yield
|
|
|
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
|
|
|
344 |
model_path=model_path,
|
345 |
temperature=0.3,
|
346 |
max_tokens=200,
|
347 |
+
n_ctx=1500,
|
348 |
top_p=0.9,
|
349 |
top_k=40,
|
350 |
n_threads=1,
|
|
|
365 |
|
366 |
retriever = qdrant_vectorstore.as_retriever(search_kwargs={"k": 3})
|
367 |
|
368 |
+
# combine_docs_chain = RefineDocumentsChain.from_llm(llm=llm)
|
369 |
+
# qa_chain = RetrievalQA(combine_documents_chain=combine_docs_chain, retriever=retriever)
|
370 |
|
371 |
+
qa_chain = RetrievalQA.from_chain_type(llm=llm, retriever=retriever, chain_type="stuff")
|
372 |
|
373 |
logger.info("Model and vector store initialized successfully.")
|
374 |
yield
|