Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,14 @@ class BasicAgent:
|
|
| 18 |
# Initialize the DuckDuckGo search tool
|
| 19 |
search_tool = DuckDuckGoSearchTool()
|
| 20 |
wiki_search = WikipediaSearchTool()
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 23 |
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated
|
| 24 |
list of numbers and/or strings.
|
|
@@ -30,13 +37,6 @@ class BasicAgent:
|
|
| 30 |
to be put in the list is a number or a string.
|
| 31 |
"""
|
| 32 |
self.agent.prompt_templates["system_prompt"] = self.agent.prompt_templates["system_prompt"] + SYSTEM_PROMPT
|
| 33 |
-
|
| 34 |
-
# Instantiate the agent
|
| 35 |
-
self.agent = CodeAgent(
|
| 36 |
-
tools=[search_tool, wiki_search],
|
| 37 |
-
model=model,
|
| 38 |
-
add_base_tools=True
|
| 39 |
-
)
|
| 40 |
def __call__(self, question: str) -> str:
|
| 41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 42 |
final_answer = self.agent.run(question)
|
|
|
|
| 18 |
# Initialize the DuckDuckGo search tool
|
| 19 |
search_tool = DuckDuckGoSearchTool()
|
| 20 |
wiki_search = WikipediaSearchTool()
|
| 21 |
+
|
| 22 |
+
# Instantiate the agent
|
| 23 |
+
self.agent = CodeAgent(
|
| 24 |
+
tools=[search_tool, wiki_search],
|
| 25 |
+
model=model,
|
| 26 |
+
add_base_tools=True
|
| 27 |
+
)
|
| 28 |
+
SYSTEM_PROMPT = """You are a general AI assistant. I will ask you a question. Report your thoughts, and
|
| 29 |
finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
|
| 30 |
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated
|
| 31 |
list of numbers and/or strings.
|
|
|
|
| 37 |
to be put in the list is a number or a string.
|
| 38 |
"""
|
| 39 |
self.agent.prompt_templates["system_prompt"] = self.agent.prompt_templates["system_prompt"] + SYSTEM_PROMPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def __call__(self, question: str) -> str:
|
| 41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 42 |
final_answer = self.agent.run(question)
|