SolshineMisfit commited on
Commit
53ed647
·
verified ·
1 Parent(s): 8331554

Updated back to docs further

Browse files
Files changed (1) hide show
  1. app.py +21 -8
app.py CHANGED
@@ -418,28 +418,41 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
418
  with open("prompts.yaml", 'r') as stream:
419
  prompt_templates = yaml.safe_load(stream)
420
 
 
421
  agent = CodeAgent(
422
  model=model,
423
  tools=[
424
- final_answer,
425
  Sonar_Web_Search_Tool,
426
- primary_search_tool, # Use whichever search tool was successfully initialized
427
- get_current_time_in_timezone,
428
  image_generation_tool,
429
  Dataset_Creator_Tool,
430
  Check_Dataset_Validity,
431
- visit_webpage_tool,
432
- ],
433
  max_steps=6,
434
  verbosity_level=1,
435
  grammar=None,
436
- planning_interval=None,
437
- name=None,
438
- description=None,
 
 
 
 
439
  prompt_templates=prompt_templates
440
  )
441
 
 
442
  print(f"Agent initialized with {search_tool_name} as primary search tool")
 
 
 
 
 
 
 
443
 
444
  # To fix the TypeError in Gradio_UI.py, you would need to modify that file
445
  # For now, we'll just use the agent directly
 
418
  with open("prompts.yaml", 'r') as stream:
419
  prompt_templates = yaml.safe_load(stream)
420
 
421
+ # Initialize the agent using standard smolagents patterns
422
  agent = CodeAgent(
423
  model=model,
424
  tools=[
425
+ final_answer,
426
  Sonar_Web_Search_Tool,
427
+ primary_search_tool, # This is already set to either DuckDuckGo, Google, or fallback
428
+ get_current_time_in_timezone,
429
  image_generation_tool,
430
  Dataset_Creator_Tool,
431
  Check_Dataset_Validity,
432
+ visit_webpage_tool, # This is correctly initialized as VisitWebpageTool()
433
+ ],
434
  max_steps=6,
435
  verbosity_level=1,
436
  grammar=None,
437
+ planning_interval=3,
438
+ name="Research Assistant",
439
+ description="""An AI assistant that can search the web, create datasets, and answer questions # Note about working within token limits
440
+ # When using with queries that might exceed token limits, consider:
441
+ # 1. Breaking tasks into smaller sub-tasks
442
+ # 2. Limiting the amount of data returned by search tools
443
+ # 3. Using the planning_interval to enable more effective reasoning""",
444
  prompt_templates=prompt_templates
445
  )
446
 
447
+ # Add informative message about which search tool is being used
448
  print(f"Agent initialized with {search_tool_name} as primary search tool")
449
+ print(f"Available tools: final_answer, Sonar_Web_Search_Tool, {search_tool_name}, get_current_time_in_timezone, image_generation_tool, Dataset_Creator_Tool, Check_Dataset_Validity, visit_webpage_tool")
450
+
451
+ # Note about working within token limits - add this comment
452
+ # When using with queries that might exceed token limits, consider:
453
+ # 1. Breaking tasks into smaller sub-tasks
454
+ # 2. Limiting the amount of data returned by search tools
455
+ # 3. Using the planning_interval to enable more effective reasoning
456
 
457
  # To fix the TypeError in Gradio_UI.py, you would need to modify that file
458
  # For now, we'll just use the agent directly