以 Defuddle 技能取代 Codex 內置網頁搜尋工具的提案遭拒
Replacing Codex’s built-in web search tool with an HTML-to-Markdown skill (Defuddle) — Rejected
測試以 Defuddle 將 HTML 轉為 Markdown,再用技能取代 Codex 內置網頁搜尋工具,結果未見明確效益。兩項測試中,啟用技能後的總 token 數分別為 44,502 和 44,136;作者認為內置工具似乎已作良好最佳化,並會將 HTML 標籤排除在上下文之外。
Idea
Reduce context usage when a prompt links to documentation by removing HTML tags.
The main assumption is that Codex’s built-in tool loads the page into context as-is, including the HTML tags.
Implementation
Install Defuddle, a great Node.js library that converts HTML to Markdown, globally and wrap it in a skill.
Tests
Run three sessions in an empty directory.
-
withoutruns with the skill disabled usingcodex -c 'skills.config=[{name="atolk-defuddle", enabled=false}]'. -
withruns with the skill enabled. - The third session compares the results.
Test 1. With a task
It took many rounds of editing the prompt and skill definition to get Codex to use only the information on that page and stop searching the web for more context to complete the task.
First prompt
Read https://clickhouse.com/docs/guides/clickhouse/working-with-arrays and list all functions in a numbered table, providing a one-sentence description for each function. Use only the information available on this page. Make a single request with
web search tool. Do not use search or follow any links or any kind of curl request.
| Metric | Without skill | With skill |
|---|---|---|
| Fetch method | Web tool (open) |
Defuddle |
| Fetch tool time | 9.4 s | 1.7 s |
| Total session time | 30.1 s | 26.1 s |
| Total tokens | 44,631 | 44,502 |
| Cached input | 37,376 | 26,368 |
| Uncached input | 6,397 | 17,134 |
| Output tokens | 858 | 1,000 |
Test 2. Loading the page into context
Prompt
Load the content of webpage: https://clickhouse.com/docs/guides/clickhouse/working-with-arrays
| Metric | Without skill | With skill |
|---|---|---|
| Fetch tool time | 2.1 s | 1.2 s |
| Total session time | 8.9 s | 22.6 s |
| Total tokens | 43,725 | 44,136 |
| Cached input | 26,112 | 19,328 |
| Uncached input | 17,466 | 23,986 |
| Output tokens | 147 | 822 |
Conclusion
I saw no clear benefit. The built-in web search tool appears to be well optimized and to leave HTML tags out of the context.
來源:DEV Community · dev.to