pi-web-search 1.1.0 → 1.2.1
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 +36 -11
- package/package.json +26 -8
- package/src/api.ts +808 -149
- package/src/index.ts +68 -7
- package/src/url_context.ts +49 -8
- package/src/utils.ts +49 -49
- package/src/web_search.ts +42 -12
- package/dist/api.d.ts +0 -26
- package/dist/api.js +0 -232
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -18
- package/dist/url_context.d.ts +0 -8
- package/dist/url_context.js +0 -102
- package/dist/utils.d.ts +0 -6
- package/dist/utils.js +0 -63
- package/dist/web_search.d.ts +0 -8
- package/dist/web_search.js +0 -75
- package/tsconfig.json +0 -14
package/README.md
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
# pi-web-search
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Provider-native web search for [pi](https://github.com/earendil-works/pi-coding-agent), across Google Gemini, OpenAI, and Anthropic, plus Gemini-only URL Context analysis.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Tools
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **📄 URL Analysis** - Analyze web pages, PDFs, images, and YouTube videos (up to 20 URLs)
|
|
7
|
+
### `web_search`
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
Search the web using your currently selected model. Automatically picks the right provider API:
|
|
10
|
+
|
|
11
|
+
| Provider | API |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Google Gemini | Grounding with Google Search |
|
|
14
|
+
| OpenAI | Responses API web search |
|
|
15
|
+
| Anthropic | Messages API web search |
|
|
16
|
+
|
|
17
|
+
Supports passing up to 20 additional URLs to analyze alongside the query.
|
|
18
|
+
|
|
19
|
+
### `url_context`
|
|
20
|
+
|
|
21
|
+
Gemini-only. Analyze up to 20 public URLs — web pages, documents, images, and YouTube videos. Uses Gemini's native URL Context retrieval with verified metadata.
|
|
22
|
+
|
|
23
|
+
When using `google-generative-ai`, YouTube URLs are passed as `file_data` for native video understanding.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
11
26
|
|
|
12
27
|
```bash
|
|
13
28
|
pi install npm:pi-web-search
|
|
14
29
|
```
|
|
15
30
|
|
|
16
|
-
##
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
No extra config needed. Just configure any supported provider in pi and the tools auto-detect it.
|
|
34
|
+
|
|
35
|
+
`url_context` is automatically removed from active tools when using a non-Gemini model.
|
|
36
|
+
|
|
37
|
+
## Test
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cp .env.example .env # edit with your models
|
|
41
|
+
npm test # unit tests
|
|
42
|
+
npm run test:real:web-search
|
|
43
|
+
npm run test:real:url-context
|
|
44
|
+
```
|
|
17
45
|
|
|
18
|
-
|
|
46
|
+
## License
|
|
19
47
|
|
|
20
|
-
|
|
21
|
-
- google-gemini-cli
|
|
22
|
-
- google
|
|
23
|
-
- google-generative-ai
|
|
48
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-web-search",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Provider-native web search for pi across Google Gemini, OpenAI, and Anthropic, plus Gemini URL Context",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
6
|
+
"main": "src/index.ts",
|
|
8
7
|
"keywords": [
|
|
9
8
|
"pi",
|
|
10
9
|
"pi-extension",
|
|
10
|
+
"pi-package",
|
|
11
11
|
"web-search",
|
|
12
12
|
"gemini",
|
|
13
13
|
"google",
|
|
14
|
+
"openai",
|
|
15
|
+
"anthropic",
|
|
16
|
+
"url-context",
|
|
14
17
|
"url-analysis",
|
|
15
18
|
"youtube"
|
|
16
19
|
],
|
|
@@ -24,15 +27,30 @@
|
|
|
24
27
|
"url": "https://github.com/ttttmr/pi-web-search/issues"
|
|
25
28
|
},
|
|
26
29
|
"homepage": "https://github.com/ttttmr/pi-web-search#readme",
|
|
30
|
+
"files": [
|
|
31
|
+
"src",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"test": "node --test tests/*.test.mjs",
|
|
36
|
+
"test:real:web-search": "node tests/real-web-search.mjs",
|
|
37
|
+
"test:real:url-context": "node tests/real-url-context.mjs"
|
|
38
|
+
},
|
|
27
39
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@types/node": "^
|
|
31
|
-
"
|
|
40
|
+
"@earendil-works/pi-ai": "^0.75.4",
|
|
41
|
+
"@earendil-works/pi-coding-agent": "^0.75.4",
|
|
42
|
+
"@types/node": "^25.9.1",
|
|
43
|
+
"typebox": "^1.1.38",
|
|
44
|
+
"typescript": "^6.0.3"
|
|
32
45
|
},
|
|
33
46
|
"pi": {
|
|
34
47
|
"extensions": [
|
|
35
48
|
"./src/index.ts"
|
|
36
49
|
]
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@earendil-works/pi-ai": "*",
|
|
53
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
54
|
+
"typebox": "*"
|
|
37
55
|
}
|
|
38
56
|
}
|