Raj718 commited on
Commit
719b2e8
·
1 Parent(s): 8a1badd

Fix HfApiModel import error by reverting to LiteLLMModel - HfApiModel is not available in Space smolagents version - Using LiteLLMModel with huggingface/Qwen/Qwen2.5-Coder-32B-Instruct which should work with HF_TOKEN in Space environment

Browse files
Files changed (1) hide show
  1. agent_setup.py +5 -5
agent_setup.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  from dotenv import load_dotenv
3
- from smolagents import CodeAgent, HfApiModel
4
  from smolagents.agents import PromptTemplates, PlanningPromptTemplate, ManagedAgentPromptTemplate, FinalAnswerPromptTemplate
5
  from tools import find_matching_listings, get_listing_violations, final_answer, comms_tool
6
  from nearest_subway_tool import nearest_subway_tool
@@ -219,8 +219,8 @@ def initialize_caseworker_agent():
219
  "timestamp": current_timestamp()
220
  })
221
 
222
- model = HfApiModel(
223
- model_id="Qwen/Qwen2.5-Coder-32B-Instruct"
224
  )
225
 
226
  prompt_templates = PromptTemplates(
@@ -264,8 +264,8 @@ def initialize_caseworker_agent():
264
 
265
  log_tool_action("AgentSetup", "caseworker_initialized", {
266
  "tools_count": len(tools),
267
- "model": "Qwen/Qwen2.5-Coder-32B-Instruct",
268
- "provider": "HfApiModel",
269
  "agent_type": "CodeAgent"
270
  })
271
 
 
1
  import os
2
  from dotenv import load_dotenv
3
+ from smolagents import CodeAgent, LiteLLMModel
4
  from smolagents.agents import PromptTemplates, PlanningPromptTemplate, ManagedAgentPromptTemplate, FinalAnswerPromptTemplate
5
  from tools import find_matching_listings, get_listing_violations, final_answer, comms_tool
6
  from nearest_subway_tool import nearest_subway_tool
 
219
  "timestamp": current_timestamp()
220
  })
221
 
222
+ model = LiteLLMModel(
223
+ model_id="huggingface/Qwen/Qwen2.5-Coder-32B-Instruct"
224
  )
225
 
226
  prompt_templates = PromptTemplates(
 
264
 
265
  log_tool_action("AgentSetup", "caseworker_initialized", {
266
  "tools_count": len(tools),
267
+ "model": "huggingface/Qwen/Qwen2.5-Coder-32B-Instruct",
268
+ "provider": "LiteLLMModel",
269
  "agent_type": "CodeAgent"
270
  })
271