Added web search.
Browse files
app.py
CHANGED
@@ -19,6 +19,9 @@ huggingface_hub.login(os.getenv('HF_TOKEN'))
|
|
19 |
# --- Constants ---
|
20 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
21 |
|
|
|
|
|
|
|
22 |
@tool
|
23 |
def say_hello() -> str:
|
24 |
"""A tool that says hello
|
@@ -64,9 +67,9 @@ max_tokens=2096,
|
|
64 |
temperature=0.5,
|
65 |
#model_id='deepseek-ai/deepseek-coder-7b-instruct-v1.5',# it is possible that this model may be overloaded
|
66 |
#model_id='Qwen/Qwen2.5-Coder-7B-Instruct',
|
67 |
-
|
68 |
#model_id='Qwen/Qwen2.5-72B-Instruct',
|
69 |
-
model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
|
70 |
custom_role_conversions=None,
|
71 |
)
|
72 |
|
@@ -79,7 +82,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
79 |
|
80 |
agent = CodeAgent(
|
81 |
model=model,
|
82 |
-
tools=[final_answer, say_hello, image_generation_tool], ## add your tools here (don't remove final answer)
|
83 |
max_steps=6,
|
84 |
verbosity_level=1,
|
85 |
grammar=None,
|
|
|
19 |
# --- Constants ---
|
20 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
21 |
|
22 |
+
# Initialize the search tool
|
23 |
+
search_tool = DuckDuckGoSearchTool()
|
24 |
+
|
25 |
@tool
|
26 |
def say_hello() -> str:
|
27 |
"""A tool that says hello
|
|
|
67 |
temperature=0.5,
|
68 |
#model_id='deepseek-ai/deepseek-coder-7b-instruct-v1.5',# it is possible that this model may be overloaded
|
69 |
#model_id='Qwen/Qwen2.5-Coder-7B-Instruct',
|
70 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
71 |
#model_id='Qwen/Qwen2.5-72B-Instruct',
|
72 |
+
#model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
|
73 |
custom_role_conversions=None,
|
74 |
)
|
75 |
|
|
|
82 |
|
83 |
agent = CodeAgent(
|
84 |
model=model,
|
85 |
+
tools=[final_answer, say_hello, image_generation_tool, search_tool], ## add your tools here (don't remove final answer)
|
86 |
max_steps=6,
|
87 |
verbosity_level=1,
|
88 |
grammar=None,
|