Commit
·
4d13c26
1
Parent(s):
de2948f
New Space
Browse files
src/retrieval/retriever_chain.py
CHANGED
|
@@ -89,9 +89,12 @@ def create_qa_chain(retriever, llm):
|
|
| 89 |
Returns:
|
| 90 |
Runnable: Returns qa chain.
|
| 91 |
"""
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
qa_chain = (
|
| 94 |
-
{"context": retriever, "query": RunnablePassthrough()}
|
| 95 |
| create_prompt_template()
|
| 96 |
| llm
|
| 97 |
| StrOutputParser()
|
|
|
|
| 89 |
Returns:
|
| 90 |
Runnable: Returns qa chain.
|
| 91 |
"""
|
| 92 |
+
|
| 93 |
+
def format_docs(docs):
|
| 94 |
+
return "\n\n".join(doc.page_content for doc in docs)
|
| 95 |
|
| 96 |
qa_chain = (
|
| 97 |
+
{"context": retriever | format_docs, "query": RunnablePassthrough()}
|
| 98 |
| create_prompt_template()
|
| 99 |
| llm
|
| 100 |
| StrOutputParser()
|