webbrowse

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BrowseToolName 网页浏览工具名
	BrowseToolName = "WebBrowse"
	// FetchToolName 网页内容获取工具名
	FetchToolName = "WebFetch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowseInput

type BrowseInput struct {
	// 需要浏览的 URL
	URL string `json:"url"`
	// 浏览网页时希望解答的问题
	Question string `json:"question,omitempty"`
	// 超时时间(秒),默认 60
	Timeout int `json:"timeout,omitempty"`
}

BrowseInput 网页浏览输入

type BrowseOutput

type BrowseOutput struct {
	// 网页文本内容
	Text string `json:"text,omitempty"`
	// 对问题的回答
	Answer string `json:"answer,omitempty"`
}

BrowseOutput 网页浏览输出

type FetchInput

type FetchInput struct {
	URL string `json:"url"`
}

FetchInput 获取 URL 内容输入

type FetchOutput

type FetchOutput struct {
	StatusCode int    `json:"statusCode"`
	Content    string `json:"content"`
}

FetchOutput 获取 URL 内容输出

type WebBrowser

type WebBrowser struct {
	// contains filtered or unexported fields
}

WebBrowser 网页浏览工具

支持 JS 运行、页面渲染,通过视觉模型读取网页内容。依赖 Chrome 和视觉模型

func NewWebBrowser

func NewWebBrowser() *WebBrowser

NewWebBrowser 创建 Web 浏览器

func (*WebBrowser) DefineBrowseTool

func (wb *WebBrowser) DefineBrowseTool(g *genkit.Genkit) ai.ToolRef

DefineBrowseTool 定义浏览网页工具

func (*WebBrowser) DefineFetchTool

func (wb *WebBrowser) DefineFetchTool(g *genkit.Genkit) ai.ToolRef

DefineFetchTool 定义获取 URL 内容工具

func (*WebBrowser) RegisterTools

func (wb *WebBrowser) RegisterTools(g *genkit.Genkit) []ai.ToolRef

RegisterTools 注册工具

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL