Spaces:
Runtime error
Runtime error
Yaohui Hu commited on
Commit ·
9c8c4a6
1
Parent(s): 318d2c4
[tool] add web_search_tool
Browse files
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 |
|
|
@@ -28,15 +29,23 @@ def get_mars_time_in_yaohui_land() -> str:
|
|
| 28 |
|
| 29 |
|
| 30 |
final_answer = FinalAnswerTool()
|
|
|
|
| 31 |
|
| 32 |
# 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:
|
| 33 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 34 |
|
| 35 |
-
model = HfApiModel(
|
| 36 |
-
max_tokens=2096,
|
| 37 |
-
temperature=0.5,
|
| 38 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 39 |
-
custom_role_conversions=None,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
)
|
| 41 |
|
| 42 |
|
|
@@ -48,7 +57,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 48 |
|
| 49 |
agent = CodeAgent(
|
| 50 |
model=model,
|
| 51 |
-
tools=[custom_number_generator, get_mars_time_in_yaohui_land, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 52 |
max_steps=6,
|
| 53 |
verbosity_level=1,
|
| 54 |
grammar=None,
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from smolagents import LiteLLMModel
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
final_answer = FinalAnswerTool()
|
| 32 |
+
web_search_tool = DuckDuckGoSearchTool()
|
| 33 |
|
| 34 |
# 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:
|
| 35 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 36 |
|
| 37 |
+
#model = HfApiModel(
|
| 38 |
+
#max_tokens=2096,
|
| 39 |
+
#temperature=0.5,
|
| 40 |
+
#model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 41 |
+
#custom_role_conversions=None,
|
| 42 |
+
#)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
model = LiteLLMModel(
|
| 46 |
+
model_id="ollama_chat/qwen2:7b", # Or try other Ollama-supported models
|
| 47 |
+
api_base="http://127.0.0.1:11434", # Default Ollama local server
|
| 48 |
+
num_ctx=8192,
|
| 49 |
)
|
| 50 |
|
| 51 |
|
|
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
+
tools=[custom_number_generator, get_mars_time_in_yaohui_land, image_generation_tool, web_search_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|