tavily

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ToolName = "web_search"

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 pages."`
	Answer  string                      `json:"answer,omitempty" yaml:"Answer" 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 New

func New() (*Tool, error)

func NewWithAPIKey

func NewWithAPIKey(apikey string) (*Tool, error)

func (*Tool) Call

func (t *Tool) Call(ctx context.Context, input string) (string, error)

func (*Tool) Description

func (t *Tool) Description() string

func (*Tool) Name

func (t *Tool) Name() string

func (*Tool) Parameters

func (t *Tool) Parameters() any

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

func (t *Tool) WithBaseURL(baseURL string) *Tool

func (*Tool) WithHTTPClient

func (t *Tool) WithHTTPClient(client *http.Client) *Tool

Jump to

Keyboard shortcuts

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