Add tool current time and person bio to the agent.
Browse files
app.py
CHANGED
@@ -33,6 +33,16 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
@@ -55,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def get_person_bio(name: str) -> str:
|
38 |
+
"""A tool that describes a person
|
39 |
+
Args:
|
40 |
+
name: name of the person in "firstname_lastname" format
|
41 |
+
"""
|
42 |
+
details = {
|
43 |
+
"prakash_chaudhary": "Prakash is an employee of Fetch Rewards, Inc."
|
44 |
+
}
|
45 |
+
return details.get(name, "NA")
|
46 |
|
47 |
final_answer = FinalAnswerTool()
|
48 |
|
|
|
65 |
|
66 |
agent = CodeAgent(
|
67 |
model=model,
|
68 |
+
tools=[get_current_time_in_timezone, get_person_bio, final_answer], ## add your tools here (don't remove final answer)
|
69 |
max_steps=6,
|
70 |
verbosity_level=1,
|
71 |
grammar=None,
|