pi-web-search 1.4.0 → 1.6.0
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 +10 -2
- package/package.json +6 -2
- package/src/api.ts +13 -1070
- package/src/format.ts +184 -0
- package/src/index.ts +4 -3
- package/src/providers/anthropic.ts +192 -0
- package/src/providers/auth.ts +62 -0
- package/src/providers/config.ts +46 -0
- package/src/providers/google.ts +228 -0
- package/src/providers/openai.ts +323 -0
- package/src/providers/results.ts +178 -0
- package/src/providers/sse.ts +94 -0
- package/src/providers/types.ts +42 -0
- package/src/url_context.ts +4 -62
- package/src/utils.ts +3 -15
- package/src/web_search.ts +9 -66
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-web-search
|
|
2
2
|
|
|
3
|
-
Provider-native web search for [pi](https://pi.dev) with Gemini + URL Context, OpenAI Responses variants, and
|
|
3
|
+
Provider-native web search for [pi](https://pi.dev) with Gemini + URL Context, xAI Grok, OpenAI Responses variants, Anthropic, and OpenCode Zen/Go.
|
|
4
4
|
|
|
5
5
|
## Tools
|
|
6
6
|
|
|
@@ -11,14 +11,18 @@ Search the web using your currently selected model. Automatically picks the righ
|
|
|
11
11
|
| Provider | API |
|
|
12
12
|
|---|---|
|
|
13
13
|
| Google Gemini | Grounding with Google Search |
|
|
14
|
+
| xAI Grok | Responses API `web_search` |
|
|
14
15
|
| OpenAI | Responses API web search |
|
|
15
16
|
| Azure OpenAI | Responses API web search (`azure-openai-responses`) |
|
|
16
17
|
| OpenAI Codex | Codex Responses API web search (`openai-codex-responses`) |
|
|
17
18
|
| GitHub Copilot | OpenAI Responses API web search via Copilot credentials |
|
|
18
19
|
| Anthropic | Messages API web search |
|
|
20
|
+
| OpenCode Zen / Go | Responses API web search (models that use the `openai-responses` API) |
|
|
19
21
|
|
|
20
22
|
GitHub Copilot OpenAI Responses models are supported, including Business and Enterprise seats whose API endpoint is resolved from their authenticated Copilot credentials. This includes models such as `gpt-5.6-sol`.
|
|
21
23
|
|
|
24
|
+
OpenCode Zen and OpenCode Go Responses models (for example `opencode-go/gpt-5.6-luna` or `opencode-go/grok-4.6`) use the same Responses web search. OpenCode routes traffic per conversation, so `web_search` sends the `x-opencode-session` and `x-opencode-client` headers pi uses, keyed to the active session. Only models exposed through that Responses API are supported: OpenCode `chat/completions` models have no provider-native search tool, and the gateway's Anthropic Messages models are unverified.
|
|
25
|
+
|
|
22
26
|
Supports passing up to 20 additional URLs to analyze alongside the query. Successful `web_search` results are collapsed by default in pi; expand the tool call to inspect the full answer and source details.
|
|
23
27
|
|
|
24
28
|
### `url_context`
|
|
@@ -37,7 +41,7 @@ pi install npm:pi-web-search
|
|
|
37
41
|
|
|
38
42
|
No extra config needed. Select a supported current model in pi and the tools auto-detect the matching provider API.
|
|
39
43
|
|
|
40
|
-
`web_search` will not scan configured models and pick one automatically when the current model does not support native search. To use a dedicated search model, opt in explicitly with
|
|
44
|
+
`web_search` will not scan configured models and pick one automatically when the current model does not support native search. To use a dedicated search model, opt in explicitly with `web-search.json` in pi's agent directory (by default `~/.pi/agent/`; respects `PI_CODING_AGENT_DIR`):
|
|
41
45
|
|
|
42
46
|
```json
|
|
43
47
|
{
|
|
@@ -48,6 +52,10 @@ No extra config needed. Select a supported current model in pi and the tools aut
|
|
|
48
52
|
|
|
49
53
|
When this file exists, `web_search` uses the configured provider/model first. If it is missing, `web_search` uses the current conversation model. If the selected model does not support native search, the tool returns an error instead of falling back.
|
|
50
54
|
|
|
55
|
+
For OpenAI Responses models (including Azure, Codex, and Copilot), `web_search` inherits the agent's current thinking level on each call. Enabled levels are clamped to the selected search model's supported levels and translated through its `thinkingLevelMap` using pi's model metadata. This also applies when `web-search.json` selects a dedicated search model. Higher effort can increase latency and cost.
|
|
56
|
+
|
|
57
|
+
When thinking is off or unavailable, or the search model is non-reasoning, the request omits `reasoning` and leaves the choice to the provider. Off does not force reasoning off: some models reject `reasoning.effort: "none"`. Google, Anthropic, and xAI behavior is unchanged.
|
|
58
|
+
|
|
51
59
|
`url_context` is automatically removed from active tools when using a non-Gemini model.
|
|
52
60
|
|
|
53
61
|
## Test
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-web-search",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Provider-native web search for pi: Gemini + URL Context, OpenAI Responses (Azure/Codex/Copilot), and
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Provider-native web search for pi: Gemini + URL Context, xAI Grok, OpenAI Responses (Azure/Codex/Copilot), Anthropic, and OpenCode Zen/Go",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"keywords": [
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
"web-search",
|
|
12
12
|
"gemini",
|
|
13
13
|
"google",
|
|
14
|
+
"xai",
|
|
15
|
+
"grok",
|
|
14
16
|
"openai",
|
|
15
17
|
"anthropic",
|
|
18
|
+
"opencode",
|
|
19
|
+
"opencode-zen",
|
|
16
20
|
"url-context",
|
|
17
21
|
"url-analysis",
|
|
18
22
|
"youtube"
|