Upload qna_chain.py
Browse files
langchain_src/qna_chain.py
CHANGED
@@ -36,6 +36,7 @@ def generate_response(input, history):
|
|
36 |
Use chat history if required to answer the question.
|
37 |
Always be very descriptive, unless stated otherwise.
|
38 |
Explain as if you are a master at this subject.
|
|
|
39 |
<context>
|
40 |
{context}
|
41 |
</context>
|
@@ -56,7 +57,7 @@ def generate_response(input, history):
|
|
56 |
|
57 |
document_chain = create_stuff_documents_chain(llm, question_answering_prompt)
|
58 |
|
59 |
-
|
60 |
{
|
61 |
"context": reordered_docs,
|
62 |
"messages": [
|
@@ -66,10 +67,10 @@ def generate_response(input, history):
|
|
66 |
}
|
67 |
)
|
68 |
|
69 |
-
return
|
70 |
|
71 |
|
72 |
if __name__ == "__main__":
|
73 |
prompt = "How should my MDPE pipe cross a Nallah?"
|
74 |
-
response = generate_response(prompt)
|
75 |
print(response)
|
|
|
36 |
Use chat history if required to answer the question.
|
37 |
Always be very descriptive, unless stated otherwise.
|
38 |
Explain as if you are a master at this subject.
|
39 |
+
If you are asked to show with an formula with anexample, then explain the basics first, then ask for specific values to use for the formula.
|
40 |
<context>
|
41 |
{context}
|
42 |
</context>
|
|
|
57 |
|
58 |
document_chain = create_stuff_documents_chain(llm, question_answering_prompt)
|
59 |
|
60 |
+
response = document_chain.invoke(
|
61 |
{
|
62 |
"context": reordered_docs,
|
63 |
"messages": [
|
|
|
67 |
}
|
68 |
)
|
69 |
|
70 |
+
return response
|
71 |
|
72 |
|
73 |
if __name__ == "__main__":
|
74 |
prompt = "How should my MDPE pipe cross a Nallah?"
|
75 |
+
response = generate_response(prompt, [])
|
76 |
print(response)
|