update 3
Browse files
app.py
CHANGED
@@ -57,16 +57,7 @@ def _combine_documents(docs, document_prompt=PromptTemplate.from_template("{page
|
|
57 |
doc_strings = [format_document(doc, document_prompt) for doc in docs]
|
58 |
return document_separator.join(doc_strings)
|
59 |
|
60 |
-
# Define the chain using LCEL
|
61 |
-
condense_question_chain = RunnableLambda(lambda x: {"chat_history": chistory, "question": x}) | CONDENSE_QUESTION_PROMPT | llmc
|
62 |
-
retriever_chain = RunnableLambda(lambda x: {"standalone_question": x}) | retriever | _combine_documents
|
63 |
-
answer_chain = ANSWER_PROMPT | llm
|
64 |
|
65 |
-
conversational_qa_chain = RunnableParallel(
|
66 |
-
condense_question=condense_question_chain,
|
67 |
-
retrieve=retriever_chain,
|
68 |
-
generate_answer=answer_chain
|
69 |
-
)
|
70 |
|
71 |
# Define the Streamlit app
|
72 |
def app():
|
@@ -76,6 +67,17 @@ def app():
|
|
76 |
'Which retriever would you like to use?',
|
77 |
('General Medicine', 'RespiratoryFishman', 'RespiratoryMurray', 'MedMRCP2', 'OldMedicine')
|
78 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
# Define retrievers based on option
|
81 |
persist_directory = {
|
|
|
57 |
doc_strings = [format_document(doc, document_prompt) for doc in docs]
|
58 |
return document_separator.join(doc_strings)
|
59 |
|
|
|
|
|
|
|
|
|
60 |
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
# Define the Streamlit app
|
63 |
def app():
|
|
|
67 |
'Which retriever would you like to use?',
|
68 |
('General Medicine', 'RespiratoryFishman', 'RespiratoryMurray', 'MedMRCP2', 'OldMedicine')
|
69 |
)
|
70 |
+
|
71 |
+
# Define the chain using LCEL
|
72 |
+
condense_question_chain = RunnableLambda(lambda x: {"chat_history": chistory, "question": x}) | CONDENSE_QUESTION_PROMPT | llmc
|
73 |
+
retriever_chain = RunnableLambda(lambda x: {"standalone_question": x}) | retriever | _combine_documents
|
74 |
+
answer_chain = ANSWER_PROMPT | llm
|
75 |
+
|
76 |
+
conversational_qa_chain = RunnableParallel(
|
77 |
+
condense_question=condense_question_chain,
|
78 |
+
retrieve=retriever_chain,
|
79 |
+
generate_answer=answer_chain
|
80 |
+
)
|
81 |
|
82 |
# Define retrievers based on option
|
83 |
persist_directory = {
|