Update agent.py
Browse files
agent.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Agent V45 —
|
2 |
import os
|
3 |
import re
|
4 |
import io
|
@@ -115,19 +115,19 @@ class GaiaAgent:
|
|
115 |
context = self.handle_file(file_content, ctype, question)
|
116 |
else:
|
117 |
context = self.search_context(question)
|
118 |
-
prompt = f"Use this context to answer the question:
|
119 |
{context}
|
120 |
|
121 |
Question:
|
122 |
{question}
|
123 |
-
Answer:"
|
124 |
answer = self.ask(prompt)
|
125 |
if not answer or "[ERROR" in answer:
|
126 |
fallback = self.search_context(question)
|
127 |
-
retry_prompt = f"Use this context to answer:
|
128 |
{fallback}
|
129 |
|
130 |
-
{question}"
|
131 |
answer = self.ask(retry_prompt)
|
132 |
return self.format_answer(answer, question)
|
133 |
except Exception as e:
|
|
|
1 |
+
# Agent V45 — poprawiony string literal (prompt)
|
2 |
import os
|
3 |
import re
|
4 |
import io
|
|
|
115 |
context = self.handle_file(file_content, ctype, question)
|
116 |
else:
|
117 |
context = self.search_context(question)
|
118 |
+
prompt = f"""Use this context to answer the question:
|
119 |
{context}
|
120 |
|
121 |
Question:
|
122 |
{question}
|
123 |
+
Answer:"""
|
124 |
answer = self.ask(prompt)
|
125 |
if not answer or "[ERROR" in answer:
|
126 |
fallback = self.search_context(question)
|
127 |
+
retry_prompt = f"""Use this context to answer:
|
128 |
{fallback}
|
129 |
|
130 |
+
{question}"""
|
131 |
answer = self.ask(retry_prompt)
|
132 |
return self.format_answer(answer, question)
|
133 |
except Exception as e:
|