Documentation
¶
Overview ¶
Package websearch provides a web search client with multiple provider backends.
The package exposes a Client interface that can be implemented by different backends (direct API calls, proxy through Airlock, etc.). NewClient creates a direct client that calls provider APIs with explicit credentials.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DirectClient ¶
type DirectClient struct {
// contains filtered or unexported fields
}
DirectClient calls search provider APIs directly.
func NewClient ¶
func NewClient(opts Options) *DirectClient
NewClient creates a direct search client from explicit options.
type Options ¶
type Options struct {
Provider string // "brave", "perplexity", "grok", "gemini", "kimi" (required)
APIKey string // provider's API key (required)
Model string // for LLM-based providers; defaults per provider
}
Options configures a direct search client. Mirrors the LLM provider pattern: single provider, single key, caller reads env.
type Request ¶
type Request struct {
Query string // search query (required)
Count int // number of results, 1-10; 0 = provider default (5)
Freshness string // time filter: "day", "week", "month", "year"
Country string // 2-letter country code
Language string // ISO 639-1 language code
}
Request describes a web search query.
type Response ¶
type Response struct {
Results []Result // raw results (Brave/Perplexity) or citation sources (LLM providers)
Synthesis string // synthesized answer; only set by LLM-based providers (Grok, Gemini, Kimi)
Provider string // which provider produced these results
}
Response contains web search results.
type ToolInput ¶
type ToolInput struct {
Query string `json:"query" description:"Search query string"`
Count int `json:"count,omitempty" description:"Number of results to return (1-10, default 5)"`
Freshness string `json:"freshness,omitempty" description:"Time filter: day, week, month, or year" enum:"day,week,month,year"`
Country string `json:"country,omitempty" description:"2-letter country code for region-specific results (e.g. US, DE)"`
Language string `json:"language,omitempty" description:"ISO 639-1 language code for results (e.g. en, de, fr)"`
}
ToolInput is the JSON schema for the web_search tool.