Hugalino commited on
Commit
c405cff
·
verified ·
1 Parent(s): 6e4507a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  import gradio as gr
3
- from smolagents import CodeAgent, InferenceClientModel, OpenAIServerModel, FinalAnswerTool
4
  import requests
5
  import inspect
6
  import pandas as pd
@@ -23,9 +23,20 @@ class BasicAgent:
23
  api_base="https://api.openai.com/v1",
24
  api_key=os.environ["OPENAI_API_KEY"],
25
  )
26
- self.my_agent = CodeAgent(
 
 
 
 
 
 
 
 
 
 
27
  tools=[search_tool, google_search_tool, wiki_search_tool,
28
  visit_web_tool, FinalAnswerTool()],
 
29
  model=model,
30
  add_base_tools=True, # Add any additional base tools
31
  planning_interval=3 # Enable planning every 3 steps
 
1
  import os
2
  import gradio as gr
3
+ from smolagents import CodeAgent, InferenceClientModel, OpenAIServerModel, FinalAnswerTool, MultiStepAgent
4
  import requests
5
  import inspect
6
  import pandas as pd
 
23
  api_base="https://api.openai.com/v1",
24
  api_key=os.environ["OPENAI_API_KEY"],
25
  )
26
+ instruction = """
27
+ You are an expert in question-and-answer tasks.
28
+ You will receive questions in the following format:
29
+ "[Question content] | Task Id: [task_id] - file: '[file_name]'"
30
+
31
+ * Use the available tools to answer each question.
32
+ * If a question requires accessing an additional file, use the download tool with the provided task ID and file name.
33
+ * For questions involving mathematics or counting, write code to calculate the answer.
34
+ * Return your response in the exact format specified by the question.
35
+ """
36
+ self.my_agent = MultiStepAgent(
37
  tools=[search_tool, google_search_tool, wiki_search_tool,
38
  visit_web_tool, FinalAnswerTool()],
39
+ instructions=instruction,
40
  model=model,
41
  add_base_tools=True, # Add any additional base tools
42
  planning_interval=3 # Enable planning every 3 steps