anup220799 commited on
Commit
0ddf489
·
verified ·
1 Parent(s): 9fd9e6f

Update app.py

Browse files

Add custom tools to CodeAgent

Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -47,6 +47,8 @@ def get_current_time_in_timezone(timezone: str) -> str:
47
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
48
 
49
 
 
 
50
  final_answer = FinalAnswerTool()
51
 
52
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
@@ -68,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
68
 
69
  agent = CodeAgent(
70
  model=model,
71
- tools=[final_answer], ## add your tools here (don't remove final answer)
72
  max_steps=6,
73
  verbosity_level=1,
74
  grammar=None,
 
47
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
48
 
49
 
50
+ get_time_tool = get_current_time_in_timezone()
51
+ convert_color_tool = convert_colorname_to_hex()
52
  final_answer = FinalAnswerTool()
53
 
54
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer,convert_color_tool, get_time_tool], ## add your tools here (don't remove final answer)
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,