docs(WebSearchTool): strengthen image search guidance in prompt and schema
Browse files- README.md +3 -0
- src/tools/WebSearchTool/WebSearchTool.ts +4 -2
- src/tools/WebSearchTool/prompt.ts +13 -13
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
|
| 19 |
-
'
|
|
|
|
|
|
|
| 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 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
-
|
| 24 |
-
-
|
| 25 |
-
-
|
| 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
|