MichaelP719 commited on
Commit
771d734
·
verified ·
1 Parent(s): 5935708

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
@@ -8,7 +8,7 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
 
11
- ddg = DuckDuckGoSearchTool()
12
 
13
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
14
  @tool
@@ -53,18 +53,25 @@ def get_current_time_in_timezone(timezone: str) -> str:
53
 
54
 
55
  final_answer = FinalAnswerTool()
 
56
 
57
  # 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:
58
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
59
 
60
- model = HfApiModel(
61
- max_tokens=2096,
62
- temperature=0.5,
63
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
64
- custom_role_conversions=None,
 
 
 
 
 
 
 
65
  )
66
 
67
-
68
  # Import tool from Hub
69
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
70
 
@@ -73,7 +80,7 @@ with open("prompts.yaml", 'r') as stream:
73
 
74
  agent = CodeAgent(
75
  model=model,
76
- tools=[find_similar_songs, get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
77
  max_steps=6,
78
  verbosity_level=1,
79
  grammar=None,
 
1
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool, LiteLLMModel
2
  import datetime
3
  import requests
4
  import pytz
 
8
  from Gradio_UI import GradioUI
9
 
10
 
11
+
12
 
13
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
14
  @tool
 
53
 
54
 
55
  final_answer = FinalAnswerTool()
56
+ ddg = DuckDuckGoSearchTool()
57
 
58
  # 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:
59
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
60
 
61
+ # model = HfApiModel(
62
+ # max_tokens=2096,
63
+ # temperature=0.5,
64
+ # model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
65
+ # custom_role_conversions=None,
66
+ # )
67
+
68
+ model = LiteLLMModel(
69
+ model_id="ollama_chat/qwen2.5:7b", # Ollama model identifier
70
+ api_base="http://127.0.0.1:11434", # default Ollama HTTP port
71
+ num_ctx=8192,
72
+ temperature=0.5
73
  )
74
 
 
75
  # Import tool from Hub
76
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
77
 
 
80
 
81
  agent = CodeAgent(
82
  model=model,
83
+ tools=[find_similar_songs, get_current_time_in_timezone, final_answer, ddg], ## add your tools here (don't remove final answer)
84
  max_steps=6,
85
  verbosity_level=1,
86
  grammar=None,