Samuel Thomas commited on
Commit
26abdc4
·
1 Parent(s): d5d4678

duckduckgo debug

Browse files
Files changed (1) hide show
  1. tools.py +7 -7
tools.py CHANGED
@@ -794,7 +794,7 @@ class EnhancedDuckDuckGoSearchTool(BaseTool):
794
  "Ideal for topics that require the latest news, recent developments, or information not covered in static sources."
795
  )
796
  max_results: int = 3
797
- max_chars_per_page: int = 3000
798
  session: Any = None # Now it's optional and defaults to None
799
 
800
 
@@ -945,8 +945,8 @@ Found {len(search_results)} results, successfully processed {processed_count} pa
945
  """
946
 
947
  # Ensure the response isn't too long
948
- if len(response) > 8000:
949
- response = response[:8000] + "\n[Response truncated to prevent memory issues]"
950
 
951
  return response
952
 
@@ -1413,8 +1413,8 @@ class EnhancedYoutubeScreenshotQA(BaseTool):
1413
  def _get_config(self, key: str, default_value=None, input_data: Dict[str, Any] = None):
1414
  """Get configuration value with fallback to defaults"""
1415
  defaults = {
1416
- 'frame_interval_seconds': 5,
1417
- 'max_frames': 500,
1418
  'use_scene_detection': True,
1419
  'resize_frames': True,
1420
  'parallel_processing': True,
@@ -3333,7 +3333,7 @@ def call_tool_with_memory_management(state: AgentState) -> AgentState:
3333
  if not isinstance(tool_result, str):
3334
  tool_result = str(tool_result)
3335
 
3336
- max_length = 3000 if "wikipedia" in tool_name.lower() else 2000
3337
  if len(tool_result) > max_length:
3338
  original_length = len(tool_result)
3339
  tool_result = tool_result[:max_length] + f"... [Result truncated from {original_length} to {max_length} chars to prevent memory issues]"
@@ -3591,7 +3591,7 @@ def run_agent(agent, state: AgentState):
3591
 
3592
  # Initialize tools
3593
  WIKIPEDIA_TOOL = WikipediaSearchToolWithFAISS()
3594
- SEARCH_TOOL = EnhancedDuckDuckGoSearchTool(max_results=3, max_chars_per_page=8000)
3595
  YOUTUBE_TOOL = EnhancedYoutubeScreenshotQA()
3596
  YOUTUBE_AUDIO_TOOL = YouTubeTranscriptExtractor()
3597
  AUDIO_TRANSCRIPTION_TOOL = AudioTranscriptionTool()
 
794
  "Ideal for topics that require the latest news, recent developments, or information not covered in static sources."
795
  )
796
  max_results: int = 3
797
+ max_chars_per_page: int = 12000
798
  session: Any = None # Now it's optional and defaults to None
799
 
800
 
 
945
  """
946
 
947
  # Ensure the response isn't too long
948
+ if len(response) > 12000:
949
+ response = response[:12000] + "\n[Response truncated to prevent memory issues]"
950
 
951
  return response
952
 
 
1413
  def _get_config(self, key: str, default_value=None, input_data: Dict[str, Any] = None):
1414
  """Get configuration value with fallback to defaults"""
1415
  defaults = {
1416
+ 'frame_interval_seconds': 20,
1417
+ 'max_frames': 50,
1418
  'use_scene_detection': True,
1419
  'resize_frames': True,
1420
  'parallel_processing': True,
 
3333
  if not isinstance(tool_result, str):
3334
  tool_result = str(tool_result)
3335
 
3336
+ max_length = 12000 if "wikipedia" in tool_name.lower() else 12000
3337
  if len(tool_result) > max_length:
3338
  original_length = len(tool_result)
3339
  tool_result = tool_result[:max_length] + f"... [Result truncated from {original_length} to {max_length} chars to prevent memory issues]"
 
3591
 
3592
  # Initialize tools
3593
  WIKIPEDIA_TOOL = WikipediaSearchToolWithFAISS()
3594
+ SEARCH_TOOL = EnhancedDuckDuckGoSearchTool(max_results=3, max_chars_per_page=12000)
3595
  YOUTUBE_TOOL = EnhancedYoutubeScreenshotQA()
3596
  YOUTUBE_AUDIO_TOOL = YouTubeTranscriptExtractor()
3597
  AUDIO_TRANSCRIPTION_TOOL = AudioTranscriptionTool()