lwant commited on
Commit
895a491
Β·
1 Parent(s): 9c4e981

Enhance tool descriptions and enforce stricter input/output format guidelines in `tools.py` and `agent.py`

Browse files
src/gaia_solving_agent/agent.py CHANGED
@@ -222,6 +222,8 @@ gaia_solving_agent = FunctionAgent(
222
  Try to get resources before querying them.
223
  If the analysis require a new external resource get it first.(e.g. a set of rules or a process)
224
 
 
 
225
  You will be provided a question, some known facts summarizing the user provided context and some sub-tasks to complete.
226
  You should follow the order of the sub-tasks.
227
  """,
 
222
  Try to get resources before querying them.
223
  If the analysis require a new external resource get it first.(e.g. a set of rules or a process)
224
 
225
+ When calling a tool, the inputs should be in a valid JSON format.
226
+
227
  You will be provided a question, some known facts summarizing the user provided context and some sub-tasks to complete.
228
  You should follow the order of the sub-tasks.
229
  """,
src/gaia_solving_agent/tools.py CHANGED
@@ -27,6 +27,7 @@ async def tavily_search_web(query: str) -> str:
27
  client = AsyncTavilyClient(api_key=TAVILY_API_KEY)
28
  return str(await client.search(query))
29
 
 
30
  async def vllm_ask_image_tool(ctx: Context, query: str) -> str:
31
  """
32
  Asynchronously processes a visual-linguistic query paired with image data
@@ -86,13 +87,35 @@ async def vllm_ask_image(query: str, images: ImageDocument | list[ImageDocument]
86
  simple_web_page_reader_tool = OnDemandLoaderTool.from_defaults(
87
  SimpleWebPageReader(html_to_text=True),
88
  name="simple_web_page_reader_tool",
89
- description="Tool for loading content from a web page and return it as text",
 
 
 
 
 
 
 
 
 
 
 
 
90
  )
91
  simple_web_page_reader_toolspec = LoadAndSearchToolSpec.from_defaults(simple_web_page_reader_tool)
92
 
93
  youtube_transcript_reader_tool = OnDemandLoaderTool.from_defaults(
94
  YoutubeTranscriptReader(),
95
  name="youtube_transcript_reader_tool",
96
- description="Tool for loading the audio transcript from a youtube video and return it as text",
 
 
 
 
 
 
 
 
 
 
97
  )
98
  youtube_transcript_reader_toolspec = LoadAndSearchToolSpec.from_defaults(youtube_transcript_reader_tool)
 
27
  client = AsyncTavilyClient(api_key=TAVILY_API_KEY)
28
  return str(await client.search(query))
29
 
30
+
31
  async def vllm_ask_image_tool(ctx: Context, query: str) -> str:
32
  """
33
  Asynchronously processes a visual-linguistic query paired with image data
 
87
  simple_web_page_reader_tool = OnDemandLoaderTool.from_defaults(
88
  SimpleWebPageReader(html_to_text=True),
89
  name="simple_web_page_reader_tool",
90
+ description="""
91
+ Tool for loading content from a web page and return it as text.
92
+ Only the text content of the page is returned.
93
+
94
+ You need to be provided with a URL.
95
+ DO NOT GUESS ANY URL !
96
+ If you don't have a URL in the user request, first use a browser tool to get one.
97
+
98
+ Do not use this tool for:
99
+ - Web search
100
+ - Wikipedia pages
101
+ => You have specialized tools for those needs.
102
+ """,
103
  )
104
  simple_web_page_reader_toolspec = LoadAndSearchToolSpec.from_defaults(simple_web_page_reader_tool)
105
 
106
  youtube_transcript_reader_tool = OnDemandLoaderTool.from_defaults(
107
  YoutubeTranscriptReader(),
108
  name="youtube_transcript_reader_tool",
109
+ description=r"""
110
+ Tool for loading the audio transcript from a youtube video and return it as text.
111
+
112
+ You must provide a youtube link in one of the following format:
113
+ Supported formats include:
114
+ - youtube.com/watch?v={video_id} (with or without 'www.')
115
+ - youtube.com/embed?v={video_id} (with or without 'www.')
116
+ - youtu.be{video_id} (never includes www subdomain)
117
+
118
+ If you are provided with a youtube link in the wrong format, make it fit one the supported format.
119
+ """,
120
  )
121
  youtube_transcript_reader_toolspec = LoadAndSearchToolSpec.from_defaults(youtube_transcript_reader_tool)