chenbhao Claude Opus 4.6 commited on
Commit
925af11
Β·
1 Parent(s): 398a15b

docs(WebSearchTool): strengthen image search guidance in prompt and schema

Browse files
README.md CHANGED
@@ -169,6 +169,9 @@ mitmproxy -p 8888
169
  "voiceTTSVoice": "zh-TW-HsiaoChenNeural",
170
  "voiceLanguage": "zh-TW",
171
 
 
 
 
172
  # node-edge-tts
173
  # local whisper-stt
174
  uv venv
 
169
  "voiceTTSVoice": "zh-TW-HsiaoChenNeural",
170
  "voiceLanguage": "zh-TW",
171
 
172
+ # /imageshow
173
+ sudo pacman -S timg
174
+
175
  # node-edge-tts
176
  # local whisper-stt
177
  uv venv
src/tools/WebSearchTool/WebSearchTool.ts CHANGED
@@ -15,8 +15,10 @@ const inputSchema = lazySchema(() =>
15
  z.strictObject({
16
  query: z.string().min(2).describe('The search query to use'),
17
  search_images: z.boolean().optional().describe(
18
- 'Set to true to search for images specifically (vs general web results). ' +
19
- 'Use when the user asks to see/look up photos, images, or visual references.'
 
 
20
  ),
21
  }),
22
  )
 
15
  z.strictObject({
16
  query: z.string().min(2).describe('The search query to use'),
17
  search_images: z.boolean().optional().describe(
18
+ 'IMPORTANT: Set to true when the user asks to see/show/find photos, images, pictures, or ' +
19
+ 'visual references (e.g. "show me photos of...", "find pictures of...", "look up images of..."). ' +
20
+ 'When true, results contain direct image URLs (.jpg/.png/.gif) ready to use with ImageShowTool. ' +
21
+ 'Without this flag, image URLs are NOT available in results.'
22
  ),
23
  }),
24
  )
src/tools/WebSearchTool/prompt.ts CHANGED
@@ -10,19 +10,19 @@ export function getWebSearchPrompt(): string {
10
  - Provides up-to-date information for current events, technical documentation, and recent data
11
  - Returns structured search results including titles, URLs, and snippets
12
  - Works with all AI providers including local models
13
- - Designed for high-recall search to support reasoning and retrieval-augmented generation (RAG)
14
-
15
- Search backends (automatic β€” no action needed):
16
- - **General web search**: Uses Tavily cloud API when TAVILY_API_KEY is set; falls back to SearXNG if not
17
- - **Image search** (search_images: true): Always uses SearXNG (Tavily does not support image search)
18
-
19
- Image Search (search_images: true):
20
- - Set **search_images: true** to search specifically for images (photos, artworks, screenshots).
21
- Example: WebSearch(query: "milet ε†™ηœŸ", search_images: true)
22
- - Results include direct image URLs (img_src) that you can display with ImageShowTool(src: img_src).
23
- - Example workflow: WebSearch(query: "...", search_images: true) β†’ pick a result β†’ ImageShowTool(src: img_src)
24
- - Without search_images: true, this is a general web search and image URLs are NOT available.
25
- - DO NOT pass article/page URLs to ImageShowTool β€” it only accepts direct image URLs (.jpg/.png/.gif/.webp).
26
 
27
  CRITICAL REQUIREMENT - You MUST follow this:
28
  - After answering the user's question, you MUST include a "Sources:" section at the end of your response
 
10
  - Provides up-to-date information for current events, technical documentation, and recent data
11
  - Returns structured search results including titles, URLs, and snippets
12
  - Works with all AI providers including local models
13
+
14
+ CRITICAL RULE β€” When the user asks to see images/photos/pictures:
15
+ You MUST set search_images=true in the WebSearch call. Example:
16
+ WebSearch({ query: "milet ε†™ηœŸ", search_images: true })
17
+ This returns results with direct image URLs (.jpg/.png/.gif) that you can
18
+ immediately pass to ImageShowTool(src: url). Do NOT do general web searches
19
+ and try to find images inside pages β€” that is wasteful and often fails.
20
+ Without search_images=true, image URLs are NOT available in the results.
21
+
22
+ Image Search workflow (search_images: true):
23
+ - Results include direct image URLs ready for ImageShowTool
24
+ - Example: WebSearch(query: "...", search_images: true) β†’ pick URLs β†’ ImageShowTool(src: url)
25
+ - Do NOT pass article/page URLs to ImageShowTool β€” it only accepts direct image URLs
26
 
27
  CRITICAL REQUIREMENT - You MUST follow this:
28
  - After answering the user's question, you MUST include a "Sources:" section at the end of your response