Khalil Guetari commited on
Commit
68756ed
·
1 Parent(s): e4ad85e
Files changed (3) hide show
  1. .gitignore +3 -0
  2. app.py +8 -5
  3. tools/final_answer.py +1 -0
.gitignore CHANGED
@@ -235,3 +235,6 @@ fabric.properties
235
  #############################################
236
  ################# JETBRAINS #################
237
  #############################################
 
 
 
 
235
  #############################################
236
  ################# JETBRAINS #################
237
  #############################################
238
+
239
+ .pdm-python
240
+ pdm.lock
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -40,22 +41,24 @@ final_answer = FinalAnswerTool()
40
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
41
 
42
  model = HfApiModel(
43
- max_tokens=2096,
44
- temperature=0.5,
45
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
46
- custom_role_conversions=None,
47
  )
48
 
49
 
50
  # Import tool from Hub
51
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
 
 
52
 
53
  with open("prompts.yaml", 'r') as stream:
54
  prompt_templates = yaml.safe_load(stream)
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[image_generation_tool, DuckDuckGoSearchTool(max_results=5)], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from tools.visit_webpage import VisitWebpageTool
8
 
9
  from Gradio_UI import GradioUI
10
 
 
41
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
42
 
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
 
50
 
51
  # Import tool from Hub
52
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
53
+ search_tool = DuckDuckGoSearchTool(max_results=5)
54
+ visit_webpage_tool = VisitWebpageTool()
55
 
56
  with open("prompts.yaml", 'r') as stream:
57
  prompt_templates = yaml.safe_load(stream)
58
 
59
  agent = CodeAgent(
60
  model=model,
61
+ tools=[image_generation_tool, search_tool, visit_webpage_tool, final_answer], ## add your tools here (don't remove final answer)
62
  max_steps=6,
63
  verbosity_level=1,
64
  grammar=None,
tools/final_answer.py CHANGED
@@ -1,6 +1,7 @@
1
  from typing import Any, Optional
2
  from smolagents.tools import Tool
3
 
 
4
  class FinalAnswerTool(Tool):
5
  name = "final_answer"
6
  description = "Provides a final answer to the given problem."
 
1
  from typing import Any, Optional
2
  from smolagents.tools import Tool
3
 
4
+
5
  class FinalAnswerTool(Tool):
6
  name = "final_answer"
7
  description = "Provides a final answer to the given problem."