fiastros commited on
Commit
ec78f6e
·
verified ·
1 Parent(s): 0666f8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -9,15 +9,14 @@ from tools.final_answer import FinalAnswerTool
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
- def my_custom_tool(year:int)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that fetches the population of USA at a specific year. Do a GET call on this API:
15
- API: https://datausa.io/api/data?drilldowns=Nation&measures=Population, and get the population of the year from the response.
16
  Args:
17
- year: an integer representing a year
18
  """
19
- response = requests.get('https://datausa.io/api/data?drilldowns=Nation&measures=Population')
20
- return response.json()
21
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -43,7 +42,8 @@ final_answer = FinalAnswerTool()
43
  model = HfApiModel(
44
  max_tokens=2096,
45
  temperature=0.5,
46
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
 
47
  custom_role_conversions=None,
48
  )
49
 
@@ -56,7 +56,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
+ def get_weather(city:str)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
+ """A tool that fetches the current weather of a city.
 
15
  Args:
16
+ city: A string representing an existing city (e.g paris)
17
  """
18
+
19
+ return f"The current weather in {city} is cloudy."
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
42
  model = HfApiModel(
43
  max_tokens=2096,
44
  temperature=0.5,
45
+ model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
46
+ #model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
47
  custom_role_conversions=None,
48
  )
49
 
 
56
 
57
  agent = CodeAgent(
58
  model=model,
59
+ tools=[final_answer, get_weather], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,