pi-web-providers 2.4.1 β†’ 2.5.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.
Files changed (3) hide show
  1. package/README.md +85 -48
  2. package/dist/index.js +5422 -5473
  3. package/package.json +21 -20
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
1
  # 🌍 pi-web-providers
2
2
 
3
3
  A _meta_ web extension for [pi](https://pi.dev) that routes search, content
4
- extraction, answers, and research through configurable per-tool providers, with
5
- explicit provider-specific option schemas for each managed tool.
4
+ extraction, quick grounded answers, and research through configurable per-tool
5
+ providers, with explicit provider-specific option schemas for each managed tool.
6
6
 
7
7
  ## Why?
8
8
 
9
9
  Most web extensions hard-wire a single backend. **pi-web-providers** lets you
10
10
  mix and match providers per tool instead, so `web_search`, `web_contents`,
11
11
  `web_answer`, and `web_research` can each use a different backend or be turned
12
- off entirely.
12
+ off entirely. Treat `web_answer` as a fast path for simple grounded questions,
13
+ not as a replacement for source inspection or deeper research.
13
14
 
14
15
  ## ✨ Features
15
16
 
16
17
  - **Multiple providers**: Claude, Cloudflare, Codex, Exa, Firecrawl,
17
- Gemini, Linkup, OpenAI, Perplexity, Parallel, Serper,
18
+ Gemini, Linkup, Ollama, OpenAI, Perplexity, Parallel, Serper,
18
19
  [Tavily](https://tavily.com), Valyu
19
20
  - **Provider-aware tool options**: pi only exposes the provider settings that
20
21
  actually apply to the backend you selected, so tool calls are easier to
@@ -61,6 +62,7 @@ Each tool can be routed to any compatible provider:
61
62
  | **Firecrawl** | βœ” | βœ” | | | `FIRECRAWL_API_KEY` |
62
63
  | **Gemini** | βœ” | | βœ” | βœ” | `GOOGLE_API_KEY` |
63
64
  | **Linkup** | βœ” | βœ” | | | `LINKUP_API_KEY` |
65
+ | **Ollama** | βœ” | βœ” | | | `OLLAMA_API_KEY` |
64
66
  | **OpenAI** | βœ” | | βœ” | βœ” | `OPENAI_API_KEY` |
65
67
  | **Parallel** | βœ” | βœ” | | | `PARALLEL_API_KEY` |
66
68
  | **Perplexity** | βœ” | | βœ” | βœ” | `PERPLEXITY_API_KEY` |
@@ -68,9 +70,8 @@ Each tool can be routed to any compatible provider:
68
70
  | **Tavily** | βœ” | βœ” | | | `TAVILY_API_KEY` |
69
71
  | **Valyu** | βœ” | βœ” | βœ” | βœ” | `VALYU_API_KEY` |
70
72
 
71
- Advanced option: `custom` is a configurable adapter provider that can route
72
- any managed tool through a local wrapper command using a JSON stdin/stdout
73
- contract.
73
+ Advanced option: `custom` can route any managed tool through a local wrapper
74
+ command using a JSON stdin/stdout contract.
74
75
 
75
76
  See [`example-config.json`](example-config.json) for the minimal default
76
77
  configuration.
@@ -82,7 +83,8 @@ Removing a tool mapping turns that tool off. A tool is only exposed when it is
82
83
  mapped to a compatible provider and that provider is currently available.
83
84
  Shared defaults and tool-specific settings live under `settings`; search-specific
84
85
  settings live under `settings.search`, and async research uses
85
- `settings.researchTimeoutMs`.
86
+ `settings.researchTimeoutMs`. Provider option schemas are strict: only the keys
87
+ shown for the active provider are accepted.
86
88
 
87
89
  #### `web_search`
88
90
 
@@ -94,18 +96,16 @@ results should arrive as soon as they are ready.
94
96
  <details>
95
97
  <summary><strong>Parameters and behavior</strong></summary>
96
98
 
97
- | Parameter | Type | Default | Description |
98
- | ------------ | -------- | -------- | ------------------------------------------------------------------------------------------ |
99
- | `queries` | string[] | required | One or more search queries to run (max 10) |
100
- | `maxResults` | integer | `5` | Result count per query, clamped to `1–20` |
101
- | `options` | object | β€” | `provider` settings exposed by the selected provider schema, plus local `runtime` settings |
99
+ | Parameter | Type | Default | Description |
100
+ | ------------ | -------- | -------- | ------------------------------------------------------------------ |
101
+ | `queries` | string[] | required | One or more search queries to run (max 10) |
102
+ | `maxResults` | integer | `5` | Result count per query, clamped to `1–20` |
103
+ | `options` | object | β€” | Provider-specific settings exposed by the selected provider schema |
102
104
 
103
- `web_search.options.runtime.prefetch` is local-only and is not forwarded to the
104
- provider SDK. It accepts `provider`, `maxUrls`, and `ttlMs`, and starts a
105
- background page-extraction workflow only when `prefetch.provider` is set.
106
- `/web-providers` can also persist default search prefetch settings under
107
- `settings.search`. Per-call retry and timeout overrides also live under
108
- `web_search.options.runtime`.
105
+ `options` is omitted when the configured search provider has no per-call
106
+ provider options. Runtime controls are not accepted in tool calls. Configure
107
+ retry, timeout, and background contents prefetch under `settings` and
108
+ `settings.search`; prefetch starts only when `settings.search.provider` is set.
109
109
 
110
110
  </details>
111
111
 
@@ -119,10 +119,10 @@ each page can be acted on independently.
119
119
  <details>
120
120
  <summary><strong>Parameters and behavior</strong></summary>
121
121
 
122
- | Parameter | Type | Default | Description |
123
- | --------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------- |
124
- | `urls` | string[] | required | One or more URLs to extract |
125
- | `options` | object | β€” | `provider` extraction settings exposed by the selected provider schema, plus optional local `runtime` overrides |
122
+ | Parameter | Type | Default | Description |
123
+ | --------- | -------- | -------- | ------------------------------------------------------------------ |
124
+ | `urls` | string[] | required | One or more URLs to extract |
125
+ | `options` | object | β€” | Provider-specific settings exposed by the selected provider schema |
126
126
 
127
127
  `web_contents` reuses any matching cached pages already present in the local
128
128
  in-memory cacheβ€”whether they came from prefetch or an earlier readβ€”and only
@@ -132,18 +132,24 @@ fetches missing or stale URLs.
132
132
 
133
133
  #### `web_answer`
134
134
 
135
- Answer one or more questions using web-grounded evidence. When you ask more
136
- than one question, the response is grouped into per-question sections. Batch
137
- related questions when the answers belong together; split them into sibling
138
- calls when earlier independent answers can unblock the next step.
135
+ Answer one or more simple factual questions using web-grounded evidence. Use it
136
+ as a lightweight shortcut when you want a concise grounded answer without
137
+ manually selecting and reading sources. Prefer `web_search` plus `web_contents`
138
+ when source selection matters or you need to inspect primary sources directly;
139
+ prefer `web_research` for open-ended, controversial, or multi-step
140
+ investigations.
141
+
142
+ When you ask more than one question, the response is grouped into per-question
143
+ sections. Batch related questions when the answers belong together; split them
144
+ into sibling calls when earlier independent answers can unblock the next step.
139
145
 
140
146
  <details>
141
147
  <summary><strong>Parameters and behavior</strong></summary>
142
148
 
143
- | Parameter | Type | Default | Description |
144
- | --------- | -------- | -------- | ---------------------------------------------------------------------------------------------------- |
145
- | `queries` | string[] | required | One or more questions to answer in one call (max 10) |
146
- | `options` | object | β€” | `provider` settings exposed by the selected provider schema, plus optional local `runtime` overrides |
149
+ | Parameter | Type | Default | Description |
150
+ | --------- | -------- | -------- | ------------------------------------------------------------------ |
151
+ | `queries` | string[] | required | One or more questions to answer in one call (max 10) |
152
+ | `options` | object | β€” | Provider-specific settings exposed by the selected provider schema |
147
153
 
148
154
  Responses are grouped into per-question sections when more than one question is
149
155
  provided.
@@ -160,15 +166,15 @@ saved report path.
160
166
  <details>
161
167
  <summary><strong>Parameters and behavior</strong></summary>
162
168
 
163
- | Parameter | Type | Default | Description |
164
- | --------- | ------ | -------- | ----------------------------------------------------------------------------- |
165
- | `input` | string | required | Research brief or question |
166
- | `options` | object | β€” | Provider-specific `provider` settings exposed by the selected provider schema |
169
+ | Parameter | Type | Default | Description |
170
+ | --------- | ------ | -------- | ------------------------------------------------------------------ |
171
+ | `input` | string | required | Research brief or question |
172
+ | `options` | object | β€” | Provider-specific settings exposed by the selected provider schema |
167
173
 
168
- `options.provider` is provider-specific. Equivalent concepts can use different
169
- field names across SDKsβ€”for example Perplexity uses `country`, Exa uses
170
- `userLocation`, and Valyu uses `countryCode`. Unlike the other managed tools,
171
- `web_research` does not support per-call `options.runtime` overrides.
174
+ `options` is provider-specific. Equivalent concepts can use different field
175
+ names across SDKsβ€”for example Perplexity uses `country`, Exa uses
176
+ `userLocation`, and Valyu uses `countryCode`. Runtime controls are not accepted
177
+ in tool calls.
172
178
 
173
179
  Unlike the other managed tools, `web_research` does not accept local timeout,
174
180
  retry, polling, or resume controls. Research has one opinionated execution
@@ -179,14 +185,13 @@ report under `.pi/artifacts/research/`.
179
185
 
180
186
  ### Providers
181
187
 
182
- The built-in providers below are thin adapters around official SDKs.
188
+ The built-in providers below integrate with official SDKs or documented APIs.
183
189
 
184
190
  <details>
185
191
  <summary><strong>Claude</strong></summary>
186
192
 
187
193
  - SDK: `@anthropic-ai/claude-agent-sdk`
188
- - Uses Claude Code's built-in `WebSearch` and `WebFetch` tools behind a
189
- structured JSON adapter
194
+ - Uses Claude Code's built-in `WebSearch` and `WebFetch` tools with structured JSON output
190
195
  - Exposes `model`, `thinking`, `effort`, `maxThinkingTokens`, `maxTurns`, and
191
196
  `maxBudgetUsd` as provider options for search and answer calls
192
197
  - Great for search plus grounded answers if you already use Claude Code locally
@@ -253,8 +258,7 @@ scope, or account ID is usually wrong.
253
258
  - Exposes search options such as `category`, `type`, date filters,
254
259
  `includeDomains`, `excludeDomains`, `userLocation`, and `contents`
255
260
  - Persisted Exa defaults are scoped under `providers.exa.options.search`
256
- - `web_contents`, `web_answer`, and `web_research` currently use fixed adapter
257
- behavior with no extra per-call provider options
261
+ - `web_contents`, `web_answer`, and `web_research` currently use fixed provider behavior with no extra per-call provider options
258
262
 
259
263
  </details>
260
264
 
@@ -281,8 +285,11 @@ scope, or account ID is usually wrong.
281
285
  - Google Search grounding for answers
282
286
  - Deep-research agents via Google's Gemini API
283
287
  - Exposes `model` and `generation_config` for search, `model` and `config`
284
- for answers, and `agent_config`, `store`, `response_format`,
285
- `response_modalities`, `system_instruction`, and `tools` for research
288
+ for answers, and only the conservative deep-research option
289
+ `agent_config.thinking_summaries` for research
290
+ - Gemini research intentionally does not expose or send Interactions API
291
+ `tools`, `response_format`, `response_modalities`, or `system_instruction`
292
+ because the default deep-research agent rejects several of those fields
286
293
 
287
294
  </details>
288
295
 
@@ -299,6 +306,36 @@ scope, or account ID is usually wrong.
299
306
 
300
307
  </details>
301
308
 
309
+ <details>
310
+ <summary><strong>Ollama</strong></summary>
311
+
312
+ - API: [Ollama Web Search and Fetch API](https://docs.ollama.com/capabilities/web-search)
313
+ - Supports `web_search` via Ollama's `POST /api/web_search` endpoint
314
+ - Supports `web_contents` via Ollama's `POST /api/web_fetch` endpoint
315
+ - Authenticates with an Ollama API key using `OLLAMA_API_KEY` by default
316
+ - Optional `baseUrl` overrides the default `https://ollama.com` API host for
317
+ proxies or compatible endpoints
318
+ - Ollama caps search requests at 10 results, so `web_search.maxResults` is
319
+ clamped to `1–10` for this provider
320
+
321
+ Minimal config:
322
+
323
+ ```json
324
+ {
325
+ "tools": {
326
+ "search": "ollama",
327
+ "contents": "ollama"
328
+ },
329
+ "providers": {
330
+ "ollama": {
331
+ "apiKey": "OLLAMA_API_KEY"
332
+ }
333
+ }
334
+ }
335
+ ```
336
+
337
+ </details>
338
+
302
339
  <details>
303
340
  <summary><strong>OpenAI</strong></summary>
304
341
 
@@ -436,7 +473,7 @@ Minimal config:
436
473
  - Exposes answer and research options `responseLength` and `countryCode`
437
474
  - Persisted Valyu defaults are scoped under `providers.valyu.options.search`,
438
475
  `providers.valyu.options.answer`, and `providers.valyu.options.research`
439
- - `web_contents` currently uses fixed adapter behavior with no extra per-call
476
+ - `web_contents` currently uses fixed provider behavior with no extra per-call
440
477
  provider options
441
478
 
442
479
  </details>
@@ -447,7 +484,7 @@ The `custom` provider lets you bring your own wrapper command for any
447
484
  managed tool. Each capability can point at a different local command under
448
485
  `providers["custom"].options`.
449
486
 
450
- `custom` does not expose standard per-call `options.provider` fields. Put
487
+ `custom` does not expose standard per-call `options` fields. Put
451
488
  provider-specific behavior in the wrapper configuration or in the wrapper
452
489
  implementation.
453
490