Update demo.py
Browse files
demo.py
CHANGED
@@ -124,10 +124,10 @@ prompt = PromptTemplate(
|
|
124 |
template=template
|
125 |
)
|
126 |
chat_history= ""
|
127 |
-
def answer(
|
128 |
llm = GooglePalm(temperature=0, google_api_key=os.environ['PALM'])
|
129 |
chain = LLMChain(llm=llm, prompt=prompt)
|
130 |
-
keywords = chain.run({'user_question':
|
131 |
|
132 |
topK=3
|
133 |
#vectorize the query
|
@@ -152,7 +152,7 @@ def answer(user_question):
|
|
152 |
)
|
153 |
|
154 |
#ans2 = llm_chain.predict(full_result_string)
|
155 |
-
ans = llm_chain.predict(
|
156 |
|
157 |
return ans
|
158 |
|
|
|
124 |
template=template
|
125 |
)
|
126 |
chat_history= ""
|
127 |
+
def answer(user_input):
|
128 |
llm = GooglePalm(temperature=0, google_api_key=os.environ['PALM'])
|
129 |
chain = LLMChain(llm=llm, prompt=prompt)
|
130 |
+
keywords = chain.run({'user_question':user_input, 'chat_history':chat_history})
|
131 |
|
132 |
topK=3
|
133 |
#vectorize the query
|
|
|
152 |
)
|
153 |
|
154 |
#ans2 = llm_chain.predict(full_result_string)
|
155 |
+
ans = llm_chain.predict(user_question= f"{full_result_string} ---\n\n {user_input}")
|
156 |
|
157 |
return ans
|
158 |
|