pi-unsloth-webtools 0.7.5 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.ts +6 -12
- package/package.json +1 -1
- package/web-search.ts +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Mirrors Unsloth Studio's `web_search` tool:
|
|
|
39
39
|
re-serialized, collapsing host-case, default-port, and trailing-slash variants — so the
|
|
40
40
|
same page found via different tracking links collapses), and the same `SimpleFilterRanker`
|
|
41
41
|
re-ranking. Formats results identically: `Title:` / `URL:` /
|
|
42
|
-
`Snippet:` blocks separated by `---`, ending with the hint to
|
|
42
|
+
`Snippet:` blocks separated by `---`, ending with the hint to call `web_fetch` to
|
|
43
43
|
read a full page.
|
|
44
44
|
- Accepts an optional `url` parameter; when given, fetches that page's text instead of
|
|
45
45
|
searching (optionally truncated with `maxChars`). An HTTP 403 on that fetch falls back
|
package/index.ts
CHANGED
|
@@ -143,12 +143,10 @@ export function createWebTools(deps: WebToolsDeps = {}) {
|
|
|
143
143
|
name: "web_search",
|
|
144
144
|
label: "Web Search",
|
|
145
145
|
description:
|
|
146
|
-
"Search the web and
|
|
147
|
-
|
|
148
|
-
"A direct fetch refused with HTTP 403 falls back to web_render when that tool is enabled.",
|
|
149
|
-
promptSnippet: "Search the web and fetch page content",
|
|
146
|
+
"Search the web and return snippets for the top results. Pass url instead of query to read a page found in the same search; use web_fetch for known URLs.",
|
|
147
|
+
promptSnippet: "Search the web and return snippets",
|
|
150
148
|
promptGuidelines: [
|
|
151
|
-
|
|
149
|
+
"Web tool order: web_search to discover, web_fetch for a known URL, web_render only when web_fetch cannot read the page.",
|
|
152
150
|
],
|
|
153
151
|
parameters: WebSearchParams,
|
|
154
152
|
renderCall(args, theme) {
|
|
@@ -200,10 +198,9 @@ export function createWebTools(deps: WebToolsDeps = {}) {
|
|
|
200
198
|
"README API, so the README is returned instead of the repo page's UI chrome. " +
|
|
201
199
|
"Private/loopback/link-local targets and local files (file:// URLs, absolute, ~/ or ./ paths, including " +
|
|
202
200
|
"PDFs) are supported by default; opt out with webFetch.allowPrivateAddresses: false or " +
|
|
203
|
-
"webFetch.allowLocalFiles: false in settings. The download size is capped.
|
|
204
|
-
"A direct fetch refused with HTTP 403 falls back to web_render (Jina Reader) when that tool is enabled.",
|
|
201
|
+
"webFetch.allowLocalFiles: false in settings. The download size is capped.",
|
|
205
202
|
promptGuidelines: [
|
|
206
|
-
"web_fetch
|
|
203
|
+
"web_fetch retries an HTTP 403 through web_render automatically; never call web_render again for the same URL after a 403.",
|
|
207
204
|
],
|
|
208
205
|
promptSnippet: "Fetch a web page and return readable text content",
|
|
209
206
|
parameters: WebFetchParams,
|
|
@@ -235,13 +232,10 @@ export function createWebTools(deps: WebToolsDeps = {}) {
|
|
|
235
232
|
label: "Web Render",
|
|
236
233
|
description:
|
|
237
234
|
"Render a public web page to Markdown through the third-party Jina Reader (r.jina.ai). " +
|
|
238
|
-
"Use it
|
|
235
|
+
"Use it when web_fetch cannot read the page: JavaScript-rendered pages, or pages where web_fetch returned \"(page returned no readable text)\". " +
|
|
239
236
|
"The target URL is sent to Jina; local files and non-public addresses are refused. " +
|
|
240
237
|
"An optional JINA_API_KEY or unslothWebTools.jinaApiKey raises the Reader's rate limits.",
|
|
241
238
|
promptSnippet: "Render a JavaScript-rendered page to Markdown via the Jina Reader",
|
|
242
|
-
promptGuidelines: [
|
|
243
|
-
'Use web_render when web_fetch reports "(page returned no readable text)" or the page only fills in through JavaScript.',
|
|
244
|
-
],
|
|
245
239
|
parameters: WebRenderParams,
|
|
246
240
|
renderCall(args, theme) {
|
|
247
241
|
return toolCallLine(theme, "web_render", collapsedArg(args.url));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-unsloth-webtools",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pi extension: web_search and web_fetch tools that began as a port of the Unsloth Studio codebase and now diverge from it (multi-engine search, opt-in SSRF guard, HTML-to-Markdown extraction)",
|
|
6
6
|
"main": "index.ts",
|
package/web-search.ts
CHANGED
|
@@ -114,6 +114,6 @@ export function formatSearchResults(results: SearchResult[]): string {
|
|
|
114
114
|
return (
|
|
115
115
|
text +
|
|
116
116
|
"\n\n---\n\nThese are only short snippets. " +
|
|
117
|
-
|
|
117
|
+
"To read a page, call web_fetch with its URL."
|
|
118
118
|
);
|
|
119
119
|
}
|