Documentation
¶
Index ¶
- Constants
- type Config
- type WebHelper
- func (w *WebHelper) Close() error
- func (w *WebHelper) GoogleSearch(ctx context.Context, query string) (string, error)
- func (w *WebHelper) GoogleSearchTool() ds4.Tool
- func (w *WebHelper) Search(ctx context.Context, query string, provider string) (string, error)
- func (w *WebHelper) VisitPage(ctx context.Context, targetURL string) (string, error)
- func (w *WebHelper) VisitPageTool() ds4.Tool
Constants ¶
const GoogleSearchParametersSchema = `{
"type": "object",
"properties": {
"query": {
"type": "string"
}
},
"required": [
"query"
]
}`
const VisitPageParametersSchema = `{
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"required": [
"url"
]
}`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// HomeDir is the directory containing user configuration.
// Defaults to $HOME, or "." if unset.
HomeDir string
// Port is the debugging port to run Chrome on. Defaults to 9333.
Port int
// ChromePath is the path to the Chrome or Chromium executable.
// If empty, auto-detection searches standard paths.
ChromePath string
// ConfirmApproval is called to prompt the user before starting Chrome for the first time.
// If nil, starting Chrome will fail with an error.
ConfirmApproval func(message string) (bool, error)
// Log receives status messages from the helper.
Log func(message string)
// SearchProvider specifies the search engine to use.
// Supported values: "google" (default), "duckduckgo", "bing".
SearchProvider string
}
Config configures the WebHelper.
type WebHelper ¶
type WebHelper struct {
// contains filtered or unexported fields
}
WebHelper implements browser-backed web tools using Chrome DevTools Protocol.
func (*WebHelper) Close ¶
Close terminates the spawned Chrome browser if it was started by this helper.
func (*WebHelper) GoogleSearch ¶
GoogleSearch searches Google (or the default configured SearchProvider) and returns search result Markdown links.
func (*WebHelper) GoogleSearchTool ¶
func (w *WebHelper) GoogleSearchTool() ds4.Tool
GoogleSearchTool returns the Tool schema and handler for Google Search.
func (*WebHelper) Search ¶
Search executes a web search using the specified provider and returns Markdown links. Supported providers: "google", "duckduckgo", "bing". If provider is empty, the default configured SearchProvider is used (falling back to "google").
func (*WebHelper) VisitPage ¶
VisitPage navigates to a URL, optionally scrolls, and extracts its text layout.
func (*WebHelper) VisitPageTool ¶
func (w *WebHelper) VisitPageTool() ds4.Tool
VisitPageTool returns the Tool schema and handler for visiting web pages.