Spaces:
Sleeping
Sleeping
Update BasicAgent.py
Browse files- BasicAgent.py +9 -2
BasicAgent.py
CHANGED
@@ -34,14 +34,21 @@ class newAgent:
|
|
34 |
model = HfApiModel(model_id=model_id, token=hf_token)
|
35 |
# add_base_tools=True already gives you search, python, etc.
|
36 |
self.agent = CodeAgent(tools=[], model=model, add_base_tools=True)
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
def __call__(self, question: str) -> str:
|
39 |
"""ONE question in β ONE pure-text answer out."""
|
40 |
#β Replace .run with whatever method actually returns the answer string.
|
41 |
result = self.agent.run(question)
|
42 |
return answer
|
43 |
|
44 |
-
#answer = self.run
|
45 |
|
46 |
#agent.run(
|
47 |
# "At what temperature and for how long should I bake French baguettes made with type 65 flour?",
|
|
|
34 |
model = HfApiModel(model_id=model_id, token=hf_token)
|
35 |
# add_base_tools=True already gives you search, python, etc.
|
36 |
self.agent = CodeAgent(tools=[], model=model, add_base_tools=True)
|
37 |
+
#*
|
38 |
+
# include FinalAnswerTool in tools so agent knows when to stop
|
39 |
+
tools = [FinalAnswerTool()]
|
40 |
+
self.agent = CodeAgent(
|
41 |
+
tools=tools,
|
42 |
+
model=model,
|
43 |
+
add_base_tools=True
|
44 |
+
#*
|
45 |
def __call__(self, question: str) -> str:
|
46 |
"""ONE question in β ONE pure-text answer out."""
|
47 |
#β Replace .run with whatever method actually returns the answer string.
|
48 |
result = self.agent.run(question)
|
49 |
return answer
|
50 |
|
51 |
+
#answer = self.run
|
52 |
|
53 |
#agent.run(
|
54 |
# "At what temperature and for how long should I bake French baguettes made with type 65 flour?",
|