SolshineMisfit commited on
Commit
ad13edc
·
verified ·
1 Parent(s): 6220e54

BAck to original qwen endpoint

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -266,14 +266,13 @@ def get_current_time_in_timezone(timezone: str) -> str:
266
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
267
 
268
 
 
269
  final_answer = FinalAnswerTool()
270
-
271
- # Remove the huggingface_api_key parameter - it's not supported
272
  model = HfApiModel(
273
  max_tokens=2096,
274
  temperature=0.5,
275
- model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud', # Using the backup endpoint
276
- custom_role_conversions=None
277
  )
278
 
279
  # Import tool from Hub
@@ -282,18 +281,18 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
282
  with open("prompts.yaml", 'r') as stream:
283
  prompt_templates = yaml.safe_load(stream)
284
 
 
285
  agent = CodeAgent(
286
  model=model,
287
  tools=[
288
- final_answer,
289
  Sonar_Web_Search_Tool,
290
- ddg_search_tool, # Added DuckDuckGo search tool
291
- # google_search_tool, # Added Google search tool
292
  get_current_time_in_timezone,
293
  image_generation_tool,
294
  Dataset_Creator_Tool,
295
  Check_Dataset_Validity
296
- ],
297
  max_steps=6,
298
  verbosity_level=1,
299
  grammar=None,
@@ -303,8 +302,7 @@ agent = CodeAgent(
303
  prompt_templates=prompt_templates
304
  )
305
 
306
- # To fix the TypeError in Gradio_UI.py, you would need to modify that file
307
- # For now, we'll just use the agent directly
308
  try:
309
  GradioUI(agent).launch()
310
  except TypeError as e:
 
266
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
267
 
268
 
269
+ # Update the model configuration to use Qwen2.5-Coder
270
  final_answer = FinalAnswerTool()
 
 
271
  model = HfApiModel(
272
  max_tokens=2096,
273
  temperature=0.5,
274
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct', # Changed to Qwen model
275
+ custom_role_conversions=None,
276
  )
277
 
278
  # Import tool from Hub
 
281
  with open("prompts.yaml", 'r') as stream:
282
  prompt_templates = yaml.safe_load(stream)
283
 
284
+ # Updated CodeAgent with tools
285
  agent = CodeAgent(
286
  model=model,
287
  tools=[
288
+ final_answer,
289
  Sonar_Web_Search_Tool,
290
+ ddg_search_tool,
 
291
  get_current_time_in_timezone,
292
  image_generation_tool,
293
  Dataset_Creator_Tool,
294
  Check_Dataset_Validity
295
+ ],
296
  max_steps=6,
297
  verbosity_level=1,
298
  grammar=None,
 
302
  prompt_templates=prompt_templates
303
  )
304
 
305
+ # Launch the Gradio UI
 
306
  try:
307
  GradioUI(agent).launch()
308
  except TypeError as e: