pi-web-search 1.5.0 → 1.7.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 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, xAI Grok, OpenAI Responses variants, and Anthropic.
3
+ Provider-native web search for [pi](https://pi.dev) with Gemini + URL Context, xAI Grok, OpenAI Responses variants, Anthropic, DeepSeek, Ollama Cloud, and OpenCode Zen/Go.
4
4
 
5
5
  ## Tools
6
6
 
@@ -17,14 +17,23 @@ Search the web using your currently selected model. Automatically picks the righ
17
17
  | OpenAI Codex | Codex Responses API web search (`openai-codex-responses`) |
18
18
  | GitHub Copilot | OpenAI Responses API web search via Copilot credentials |
19
19
  | Anthropic | Messages API web search |
20
+ | DeepSeek | Anthropic-compatible Messages API `web_search_20260209` |
21
+ | Ollama Cloud | Ollama web search API (`/api/web_search`, standalone REST) |
22
+ | OpenCode Zen / Go | Responses API web search (models that use the `openai-responses` API) |
20
23
 
21
24
  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`.
22
25
 
26
+ 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. Grok ids such as `opencode-go/grok-4.6` get the Grok request shape described below unless `compat.webSearchDialect` is `"openai"`; the session headers are unchanged.
27
+
28
+ Grok models on OpenAI-compatible Responses gateways use Grok's request shape: no `web_search_call.results` include (Grok rejects it with 400), a message-array input, and inline citations. By default this applies to the native `xai` provider and to any model id starting with `grok-`, `grok.`, or equal to `grok`. Set `"compat": { "webSearchDialect": "grok" }` or `"openai"` in `models.json` to override detection, on the model or on a provider that serves only Grok; model-level `compat` wins over provider-level. Only the request shape changes: auth, error labels, and `providerKind` still follow the provider, and gateway Grok still inherits the session thinking level. Only the native `xai` provider omits `reasoning.effort`.
29
+
30
+ Ollama Cloud models (provider `ollama-cloud` or any model hosted on `ollama.com`) call Ollama's standalone web search API rather than a model tool. Auth is `OLLAMA_API_KEY` or `/login ollama-cloud`. Any `urls` are fetched through `web_fetch`. A local Ollama daemon is out of scope — the official `@ollama/pi-web-search` package covers its `/api/experimental/*` endpoints.
31
+
23
32
  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.
24
33
 
25
34
  ### `url_context`
26
35
 
27
- 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.
36
+ Gemini and Ollama Cloud. Analyze up to 20 public URLs — web pages, documents, images, and YouTube videos. Gemini uses native URL Context retrieval with verified metadata; Ollama uses its `web_fetch` endpoint (web pages and documents only).
28
37
 
29
38
  When using `google-generative-ai`, YouTube URLs are passed as `file_data` for native video understanding.
30
39
 
@@ -49,7 +58,39 @@ No extra config needed. Select a supported current model in pi and the tools aut
49
58
 
50
59
  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.
51
60
 
52
- `url_context` is automatically removed from active tools when using a non-Gemini model.
61
+ 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.
62
+
63
+ 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, xAI, and Ollama behavior is unchanged.
64
+
65
+ `url_context` is automatically removed from active tools when using a model that supports neither Gemini URL Context nor Ollama web fetch.
66
+
67
+ ### DeepSeek
68
+
69
+ Select a model from pi's `deepseek` provider and authenticate with `/login` or
70
+ `DEEPSEEK_API_KEY`. Search automatically uses DeepSeek's Anthropic-compatible
71
+ endpoint (`https://api.deepseek.com/anthropic/v1/messages`) with the same model
72
+ and credentials. A configured proxy base URL is preserved and routed through
73
+ its `/anthropic/v1/messages` endpoint; the proxy must support that route.
74
+
75
+ To use DeepSeek search with another conversation model, set `web-search.json`:
76
+
77
+ ```json
78
+ {
79
+ "provider": "deepseek",
80
+ "model": "deepseek-v4-flash"
81
+ }
82
+ ```
83
+
84
+ The selected model must be registered in pi and support DeepSeek's server-side
85
+ search. Unlike the standalone `pi-deepseek-search` extension, this integration
86
+ uses the model selected by this project's configuration; it does not read
87
+ `DEEPSEEK_SEARCH_MODEL` or silently switch models. Do not load both extensions,
88
+ since they both register `web_search`.
89
+
90
+ DeepSeek requests support cancellation through pi. Additional `urls` are included in
91
+ the prompt; Gemini's verified URL Context retrieval remains Gemini-only.
92
+
93
+ This integration was informed by [pi-deepseek-search](https://github.com/bxff/pi-deepseek-search).
53
94
 
54
95
  ## Test
55
96
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-web-search",
3
- "version": "1.5.0",
4
- "description": "Provider-native web search for pi: Gemini + URL Context, xAI Grok, OpenAI Responses (Azure/Codex/Copilot), and Anthropic",
3
+ "version": "1.7.0",
4
+ "description": "Provider-native web search for pi: Gemini + URL Context, xAI Grok, OpenAI Responses (Azure/Codex/Copilot), Anthropic, DeepSeek, and OpenCode Zen/Go",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "keywords": [
@@ -15,6 +15,9 @@
15
15
  "grok",
16
16
  "openai",
17
17
  "anthropic",
18
+ "deepseek",
19
+ "opencode",
20
+ "opencode-zen",
18
21
  "url-context",
19
22
  "url-analysis",
20
23
  "youtube"