Metadata-Version: 2.3
Name: bub-web-search
Version: 0.0.2
Summary: Web search tools for Bub
Author: Frost Ming
Author-email: Frost Ming <me@frostming.com>
Requires-Dist: aiohttp>=3.13.3
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-settings>=2.10.1
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# bub-web-search

Provider-selectable web search tools for `bub`.

## Providers

Set `BUB_SEARCH_PROVIDER` to enable exactly one search provider:

- `ollama` registers `web.search`
- `searxng` registers `searxng.search`

If the provider is unset or its required configuration is missing, neither tool is
registered.

## Installation

```bash
bub install bub-web-search
```

Run `bub onboard` to select a provider and write its configuration
interactively.

## Ollama

Required:

- `BUB_SEARCH_PROVIDER=ollama`
- `BUB_SEARCH_OLLAMA_API_KEY`

Optional:

- `BUB_SEARCH_OLLAMA_API_BASE`
  - Default: `https://ollama.com/api`

The `web.search` tool accepts `query` and `max_results`.

## SearXNG

Required:

- `BUB_SEARCH_PROVIDER=searxng`
- `BUB_SEARCH_SEARXNG_BASE_URL`

Optional:

- `BUB_SEARCH_SEARXNG_TIMEOUT_SECONDS`
  - Default: `10`
- `BUB_SEARCH_SEARXNG_DEFAULT_LANGUAGE`
- `BUB_SEARCH_SEARXNG_DEFAULT_SAFE_SEARCH`
  - `0` off, `1` moderate, `2` strict
  - Default: `1`
- `BUB_SEARCH_SEARXNG_USER_AGENT`
  - Default: `bub-web-search/1.0`
- `BUB_SEARCH_SEARXNG_AUTH_HEADER`
- `BUB_SEARCH_SEARXNG_AUTH_VALUE`

The `searxng.search` tool accepts:

- `query`
- `max_results`
- `categories`
- `engines`
- `language`
- `time_range`
- `safe_search`

The SearXNG instance must allow JSON responses from its `/search` endpoint.

## Migration From bub-searxng-search

Replace the package with `bub-web-search`, set
`BUB_SEARCH_PROVIDER=searxng`, and rename the environment variables:

- `BUB_SEARXNG_SEARCH_BASE_URL` to `BUB_SEARCH_SEARXNG_BASE_URL`
- other `BUB_SEARXNG_SEARCH_*` variables to `BUB_SEARCH_SEARXNG_*`
