Documentation
¶
Overview ¶
Package websearch provides explicit Brave and DeepSeek web-search clients and tools.
Index ¶
Constants ¶
const ProviderBrave = "brave"
const ProviderDeepSeek = "deepseek"
const ToolName = "web_search"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client has one immutable service binding and no automatic retry or fallback.
func NewBraveClient ¶
func NewBraveClient(options ClientOptions) (*Client, error)
func NewDeepSeekClient ¶
func NewDeepSeekClient(options ClientOptions) (*Client, error)
type ClientOptions ¶
type ClientOptions struct {
BaseURL string
APIKey string
// ResolveAPIKey optionally resolves a live credential immediately before each call.
ResolveAPIKey func(context.Context) (string, error)
HTTPClient *http.Client
Timeout time.Duration
}
ClientOptions binds a client to one host-selected service endpoint and credential. BaseURL is the Brave search endpoint or the DeepSeek connection base URL.
type HTTPError ¶
HTTPError reports a sanitized tool-service failure independently of model transport errors.
type Item ¶
type Item struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet,omitempty"`
Summary string `json:"summary,omitempty"`
Content string `json:"content,omitempty"`
SiteName *string `json:"site_name,omitempty"`
SiteIcon *string `json:"site_icon,omitempty"`
Date *string `json:"date,omitempty"`
Authority *int `json:"authority,omitempty"`
RerankScore *float64 `json:"rerank_score,omitempty"`
Age string `json:"age,omitempty"`
}
Item preserves source fields without inventing absent metadata.
type Request ¶
type Request struct {
Query string `json:"query"`
Count int `json:"count,omitempty"`
OriginalQuestion string `json:"ori_question,omitempty"`
Localization string `json:"localization,omitempty"`
NeedContent bool `json:"need_content"`
Country string `json:"-"`
SearchLang string `json:"-"`
Freshness string `json:"-"`
}
Request describes a search. DeepSeek supports OriginalQuestion, Localization and NeedContent; Brave supports Country, SearchLang and Freshness. Unsupported fields are rejected.
type Result ¶
type Result struct {
Provider string `json:"provider"`
Query string `json:"query"`
Results []Item `json:"results"`
}
Result is a complete source response; an empty Results slice is a successful empty search.
type ToolOptions ¶
type ToolOptions struct {
Name string
Permission tools.PermissionSpec
PermissionFor tools.PermissionResolver
}
ToolOptions configures tool identity and host-owned authorization, never model-selected routing.