Documentation
¶
Index ¶
- Constants
- Variables
- type SearchRequest
- type SearchResult
- type Tool
- func (t *Tool) Call(ctx context.Context, input string) (string, error)
- func (t *Tool) Description() string
- func (t *Tool) Name() string
- func (t *Tool) Parameters() any
- func (t *Tool) RegisterMCP(registrator tools.McpServerRegistrator) error
- func (t *Tool) Run(ctx context.Context, req *SearchRequest) (*SearchResult, error)
- func (t *Tool) RunMCP(ctx context.Context, req *SearchRequest) (*mcp.ToolResponse, error)
- func (t *Tool) WithBaseURL(baseURL string) *Tool
- func (t *Tool) WithHTTPClient(client *http.Client) *Tool
Constants ¶
View Source
const ToolName = "WebSearch"
Variables ¶
View Source
var DefaultAPIKeyEnvName = "TAVILY_API_KEY"
Functions ¶
This section is empty.
Types ¶
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"Query" yaml:"Query" jsonschema:"title=Search Query,description=The query to search web."`
}
SearchRequest represents the tool input.
type SearchResult ¶
type SearchResult struct {
Results []tavilyModels.SearchResult `json:"results" yaml:"Results" jsonschema:"title=Search Results,description=The results from a web search."`
Answer string `json:"answer,omitempty" yaml:"Results" jsonschema:"title=Final Answer,description=The aggregated answer from a web search."`
}
SearchResult represents the structure for a search response
func (*SearchResult) GetContent ¶
func (i *SearchResult) GetContent() string
func (*SearchResult) GetType ¶
func (i *SearchResult) GetType() llms.ChatMessageType
func (*SearchResult) String ¶
func (r *SearchResult) String() string
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool is a tool that provides a web search functionality
func NewWithAPIKey ¶
func (*Tool) Description ¶
func (*Tool) Parameters ¶
func (*Tool) RegisterMCP ¶ added in v0.1.9
func (t *Tool) RegisterMCP(registrator tools.McpServerRegistrator) error
func (*Tool) Run ¶
func (t *Tool) Run(ctx context.Context, req *SearchRequest) (*SearchResult, error)
func (*Tool) RunMCP ¶ added in v0.1.9
func (t *Tool) RunMCP(ctx context.Context, req *SearchRequest) (*mcp.ToolResponse, error)
func (*Tool) WithBaseURL ¶
Click to show internal directories.
Click to hide internal directories.