102 lines
1.8 KiB
Markdown
102 lines
1.8 KiB
Markdown
# pi-web-search
|
|
|
|
`pi-web-search` is a Pi extension package that adds `web_search` and `web_fetch` tools backed by pluggable providers such as Exa, Tavily, and Firecrawl.
|
|
|
|
## Install
|
|
|
|
Local path:
|
|
|
|
```bash
|
|
pi install /absolute/path/to/web-search
|
|
```
|
|
|
|
Git:
|
|
|
|
```bash
|
|
pi install https://gitea.rwiesner.com/pi/pi-web-search
|
|
```
|
|
|
|
## Resources
|
|
|
|
- Extension: `./index.ts`
|
|
|
|
## Configuration
|
|
|
|
Provider configuration is managed by the extension's own commands and config files.
|
|
|
|
Example `~/.pi/agent/web-search.json`:
|
|
|
|
```json
|
|
{
|
|
"defaultProvider": "firecrawl-main",
|
|
"providers": [
|
|
{
|
|
"name": "firecrawl-main",
|
|
"type": "firecrawl",
|
|
"apiKey": "fc-...",
|
|
"fallbackProviders": ["exa-fallback"]
|
|
},
|
|
{
|
|
"name": "exa-fallback",
|
|
"type": "exa",
|
|
"apiKey": "exa_..."
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
Self-hosted Firecrawl:
|
|
|
|
```json
|
|
{
|
|
"defaultProvider": "firecrawl-selfhosted",
|
|
"providers": [
|
|
{
|
|
"name": "firecrawl-selfhosted",
|
|
"type": "firecrawl",
|
|
"baseUrl": "https://firecrawl.internal.example/v2"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
Tool examples:
|
|
|
|
```json
|
|
{
|
|
"query": "pi docs",
|
|
"provider": "firecrawl-main",
|
|
"firecrawl": {
|
|
"country": "DE",
|
|
"categories": ["github"],
|
|
"scrapeOptions": {
|
|
"formats": ["markdown"]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
```json
|
|
{
|
|
"urls": ["https://pi.dev"],
|
|
"provider": "firecrawl-main",
|
|
"summary": true,
|
|
"firecrawl": {
|
|
"formats": ["markdown", "summary", "images"]
|
|
}
|
|
}
|
|
```
|
|
|
|
Notes:
|
|
- Firecrawl self-hosted providers may omit `apiKey` when `baseUrl` is set.
|
|
- Firecrawl does not support generic `highlights`; use Firecrawl `formats` such as `markdown`, `summary`, and `images` instead.
|
|
|
|
Run `web-search-config` inside Pi to add or edit Tavily, Exa, and Firecrawl providers interactively.
|
|
|
|
## Development
|
|
|
|
```bash
|
|
npm install
|
|
npm test
|
|
```
|