Leonardo Kamigauti commited on
Commit
2f812c4
·
1 Parent(s): d5f981f

Try making a tool calling agent for the user_input tool

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from smolagents import CodeAgent,DuckDuckGoSearchTool,HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
@@ -95,6 +95,18 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
95
 
96
  with open("prompts.yaml", 'r') as stream:
97
  prompt_templates = yaml.safe_load(stream)
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  agent = CodeAgent(
100
  model=model,
@@ -109,6 +121,7 @@ agent = CodeAgent(
109
  planning_interval=2,
110
  name=None,
111
  description=None,
 
112
  prompt_templates=prompt_templates,
113
  additional_authorized_imports=['pandas',
114
  'matplotlib',
 
1
+ from smolagents import CodeAgent,ToolCallingAgent,HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
 
95
 
96
  with open("prompts.yaml", 'r') as stream:
97
  prompt_templates = yaml.safe_load(stream)
98
+
99
+ conversional_agent = ToolCallingAgent(model=model,
100
+ tools=[user_input],
101
+ max_steps=6,
102
+ verbosity_level=1,
103
+ grammar=None,
104
+ planning_interval=0,
105
+ name='ask_question',
106
+ description='Ask a question to the user and get the answer',
107
+ prompt_templates=prompt_templates,
108
+ add_base_tools=True,
109
+ )
110
 
111
  agent = CodeAgent(
112
  model=model,
 
121
  planning_interval=2,
122
  name=None,
123
  description=None,
124
+ managed_agents=[conversional_agent],
125
  prompt_templates=prompt_templates,
126
  additional_authorized_imports=['pandas',
127
  'matplotlib',