tools

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSearchTool

func NewSearchTool() (tool.InvokableTool, error)

NewSearchTool creates a new invokable search tool. It initializes all search adapters and strategies based on the application configuration.

func NewWebProcessTool

func NewWebProcessTool() (tool.InvokableTool, error)

NewWebProcessTool creates a new invokable web processing tool. It initializes all web scraping adapters and strategies based on the application configuration.

Types

type SearchRequest

type SearchRequest struct {
	Query      string `json:"query" jsonschema:"required,description=The search query string (required)."`
	Num        int    `json:"num" jsonschema:"minimum=1,maximum=50,description=The number of results to return, default is 10."`
	Lang       string `json:"lang" jsonschema:"description=The search language, e.g., zh-CN, en-US."`
	Region     string `json:"region" jsonschema:"description=The search region, e.g., CN, US."`
	SafeSearch string `json:"safe_search" jsonschema:"enum=off,enum=moderate,enum=strict,description=The safe search level."`
	TimeRange  string `json:"time_range" jsonschema:"description=The time range for the search, e.g., past_day, past_week."`
}

SearchRequest defines the parameters for a search request. It uses jsonschema tags to define parameter constraints for the Eino framework.

type SearchResponse

type SearchResponse struct {
	Success    bool                       `json:"success"`
	Message    string                     `json:"message,omitempty"`
	Query      string                     `json:"query"`
	Engine     string                     `json:"engine,omitempty"`
	Results    []*search.SearchResultItem `json:"results,omitempty"`
	TotalCount int                        `json:"total_count"`
	TimeTaken  int64                      `json:"time_taken_ms"`
	Error      string                     `json:"error,omitempty"`
}

SearchResponse defines the structure of the search response.

type WebScrapeRequest

type WebScrapeRequest struct {
	URL     string   `json:"url" jsonschema:"description=The URL of the web page to scrape (mutually exclusive with 'urls')."`
	URLs    []string `json:"urls" jsonschema:"description=A list of web page URLs to scrape in batch (mutually exclusive with 'url')."`
	Format  string   `` /* 136-byte string literal not displayed */
	Timeout int      `json:"timeout" jsonschema:"description=Request timeout in seconds, default is 30."`
}

WebScrapeRequest defines the parameters for a web scraping request. It uses jsonschema tags to define parameter constraints for the Eino framework.

type WebScrapeResponse

type WebScrapeResponse struct {
	Success bool              `json:"success"`
	Message string            `json:"message,omitempty"`
	Results []*web.WebContent `json:"results,omitempty"`
	Error   string            `json:"error,omitempty"`
}

WebScrapeResponse defines the structure of the web scraping response.

Jump to

Keyboard shortcuts

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