pi-web-providers 2.4.2 β 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.
- package/README.md +80 -46
- package/dist/index.js +2204 -1590
- 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
|
|
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`
|
|
72
|
-
|
|
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 | β |
|
|
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
|
-
`
|
|
104
|
-
provider
|
|
105
|
-
|
|
106
|
-
|
|
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 | β |
|
|
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.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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 | β |
|
|
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
|
|
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
|
|
169
|
-
|
|
170
|
-
`userLocation`, and Valyu uses `countryCode`.
|
|
171
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
|
@@ -302,6 +306,36 @@ scope, or account ID is usually wrong.
|
|
|
302
306
|
|
|
303
307
|
</details>
|
|
304
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
|
+
|
|
305
339
|
<details>
|
|
306
340
|
<summary><strong>OpenAI</strong></summary>
|
|
307
341
|
|
|
@@ -439,7 +473,7 @@ Minimal config:
|
|
|
439
473
|
- Exposes answer and research options `responseLength` and `countryCode`
|
|
440
474
|
- Persisted Valyu defaults are scoped under `providers.valyu.options.search`,
|
|
441
475
|
`providers.valyu.options.answer`, and `providers.valyu.options.research`
|
|
442
|
-
- `web_contents` currently uses fixed
|
|
476
|
+
- `web_contents` currently uses fixed provider behavior with no extra per-call
|
|
443
477
|
provider options
|
|
444
478
|
|
|
445
479
|
</details>
|
|
@@ -450,7 +484,7 @@ The `custom` provider lets you bring your own wrapper command for any
|
|
|
450
484
|
managed tool. Each capability can point at a different local command under
|
|
451
485
|
`providers["custom"].options`.
|
|
452
486
|
|
|
453
|
-
`custom` does not expose standard per-call `options
|
|
487
|
+
`custom` does not expose standard per-call `options` fields. Put
|
|
454
488
|
provider-specific behavior in the wrapper configuration or in the wrapper
|
|
455
489
|
implementation.
|
|
456
490
|
|