Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -33,29 +33,6 @@ 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 |
-
@tool
|
| 37 |
-
def favourite_meal(name:str)->str:
|
| 38 |
-
"""A tool that lets you know someone's favourite meal for you to cook for them. You use this tool to look up for a particular person
|
| 39 |
-
Args:
|
| 40 |
-
name: The person's name
|
| 41 |
-
"""
|
| 42 |
-
if name == "Roland":
|
| 43 |
-
return "Steak"
|
| 44 |
-
elif name == "Steve":
|
| 45 |
-
return "Burger"
|
| 46 |
-
|
| 47 |
-
@tool
|
| 48 |
-
def shopping_list(meal:str)->str:
|
| 49 |
-
"""A tool that you use once you know the meal you're going to cook for someone. You use this to determine what you need to buy at the supermarket
|
| 50 |
-
Args:
|
| 51 |
-
meal: The meal you need to buy for
|
| 52 |
-
"""
|
| 53 |
-
if meal == "Steak":
|
| 54 |
-
return "Steak, Potatoes, Tenderstem Brocolli"
|
| 55 |
-
elif meal == "Burger":
|
| 56 |
-
return "Beef, Buns, Bacon, Cheese"
|
| 57 |
-
|
| 58 |
-
|
| 59 |
final_answer = FinalAnswerTool()
|
| 60 |
|
| 61 |
# 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:
|
|
@@ -64,8 +41,8 @@ final_answer = FinalAnswerTool()
|
|
| 64 |
model = HfApiModel(
|
| 65 |
max_tokens=2096,
|
| 66 |
temperature=0.5,
|
| 67 |
-
|
| 68 |
-
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 69 |
custom_role_conversions=None,
|
| 70 |
)
|
| 71 |
|
|
@@ -78,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 78 |
|
| 79 |
agent = CodeAgent(
|
| 80 |
model=model,
|
| 81 |
-
tools=[final_answer, get_current_time_in_timezone,
|
| 82 |
max_steps=6,
|
| 83 |
verbosity_level=1,
|
| 84 |
grammar=None,
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
final_answer = FinalAnswerTool()
|
| 37 |
|
| 38 |
# 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:
|
|
|
|
| 41 |
model = HfApiModel(
|
| 42 |
max_tokens=2096,
|
| 43 |
temperature=0.5,
|
| 44 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 45 |
+
#model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 46 |
custom_role_conversions=None,
|
| 47 |
)
|
| 48 |
|
|
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
+
tools=[final_answer, get_current_time_in_timezone, DuckDuckGoSearchTool], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|