Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
@@ -226,7 +226,7 @@ def document_loading_splitting():
|
|
226 |
docs.extend(loader.load())
|
227 |
################################
|
228 |
# Document splitting
|
229 |
-
text_splitter = RecursiveCharacterTextSplitter(chunk_overlap = 250, chunk_size =
|
230 |
splits = text_splitter.split_documents(docs)
|
231 |
|
232 |
return splits
|
@@ -311,7 +311,7 @@ def llm_chain2(llm, prompt):
|
|
311 |
def rag_chain(llm, prompt, db):
|
312 |
rag_chain = RetrievalQA.from_chain_type(llm,
|
313 |
chain_type_kwargs = {"prompt": RAG_CHAIN_PROMPT},
|
314 |
-
retriever = db.as_retriever(search_kwargs = {"k":
|
315 |
return_source_documents = True)
|
316 |
result = rag_chain({"query": prompt})
|
317 |
return result["result"]
|
|
|
226 |
docs.extend(loader.load())
|
227 |
################################
|
228 |
# Document splitting
|
229 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_overlap = 250, chunk_size = 1000)
|
230 |
splits = text_splitter.split_documents(docs)
|
231 |
|
232 |
return splits
|
|
|
311 |
def rag_chain(llm, prompt, db):
|
312 |
rag_chain = RetrievalQA.from_chain_type(llm,
|
313 |
chain_type_kwargs = {"prompt": RAG_CHAIN_PROMPT},
|
314 |
+
retriever = db.as_retriever(search_kwargs = {"k": 5}),
|
315 |
return_source_documents = True)
|
316 |
result = rag_chain({"query": prompt})
|
317 |
return result["result"]
|