Spaces:
Runtime error
Runtime error
reverting changes that did not work
Browse files- main.py +10 -1
- requirements.txt +1 -1
- utils.py +1 -1
main.py
CHANGED
|
@@ -12,5 +12,14 @@ def run(question):
|
|
| 12 |
|
| 13 |
agent_chain = get_agent_chain(prompt, tools)
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
|
|
|
| 12 |
|
| 13 |
agent_chain = get_agent_chain(prompt, tools)
|
| 14 |
|
| 15 |
+
result = None
|
| 16 |
+
|
| 17 |
+
try:
|
| 18 |
+
result = agent_chain.run(question)
|
| 19 |
+
except ValueError as ve:
|
| 20 |
+
if "Could not parse LLM output:" in ve.args[0] and question.lower().startswith(tuple(question_starters)):
|
| 21 |
+
question = question + '?'
|
| 22 |
+
result = agent_chain.run(question)
|
| 23 |
+
|
| 24 |
+
return result
|
| 25 |
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
langchain==0.0.
|
| 2 |
openai==0.27.2
|
| 3 |
faiss-cpu==1.7.3
|
| 4 |
flask==2.2.3
|
|
|
|
| 1 |
+
langchain==0.0.129
|
| 2 |
openai==0.27.2
|
| 3 |
faiss-cpu==1.7.3
|
| 4 |
flask==2.2.3
|
utils.py
CHANGED
|
@@ -16,7 +16,7 @@ from langchain.embeddings import OpenAIEmbeddings
|
|
| 16 |
pickle_file = "open_ai.pkl"
|
| 17 |
index_file = "open_ai.index"
|
| 18 |
|
| 19 |
-
gpt_3_5 = OpenAI(model_name='
|
| 20 |
|
| 21 |
embeddings = OpenAIEmbeddings()
|
| 22 |
|
|
|
|
| 16 |
pickle_file = "open_ai.pkl"
|
| 17 |
index_file = "open_ai.index"
|
| 18 |
|
| 19 |
+
gpt_3_5 = OpenAI(model_name='text-davinci-002',temperature=0)
|
| 20 |
|
| 21 |
embeddings = OpenAIEmbeddings()
|
| 22 |
|