tools

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Search(param *SearchParam) safe.Result[*[]SearchResult]

func SearchImages

func SearchImages(param *SearchParam) safe.Result[*[]SearchResult]

func SearchWithOption

func SearchWithOption(param *SearchParam, opt *ClientOption) safe.Result[*[]SearchResult]

Types

type ClientOption

type ClientOption struct {
	Referrer  string
	UserAgent string
	Timeout   time.Duration
}

func NewClientOption

func NewClientOption(referrer, userAgent string, timeout time.Duration) *ClientOption

type ClientQuery

type ClientQuery struct {
	Prompt        string `json:"prompt"`
	MaxIterations int    `json:"maxIterations"`
	ModelName     string `json:"modelName"`
	Session       string `json:"session"`
}

type CoinCap

type CoinCap struct {
	Data struct {
		Symbol   string `json:"symbol"`
		PriceUsd string `json:"priceUsd"`
	} `json:"data"`
	Timestamp int64 `json:"timestamp"`
}

type DocResult

type DocResult struct {
	Text   string
	Source string
}

type Feedback

type Feedback struct {
	CallbacksHandler callbacks.Handler

	Query ClientQuery
	Llm   llms.Model
	// contains filtered or unexported fields
}

Feedback is a tool that can do math.

func (Feedback) Call

func (dw Feedback) Call(ctx context.Context, input string) (string, error)

func (Feedback) Description

func (dw Feedback) Description() string

func (Feedback) Name

func (dw Feedback) Name() string

type GetCryptoRate

type GetCryptoRate struct {
	CallbacksHandler callbacks.Handler
	// contains filtered or unexported fields
}

GetCryptoRate is a tool that can do get crypto rate.

func (GetCryptoRate) Call

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

func (GetCryptoRate) Description

func (t GetCryptoRate) Description() string

func (GetCryptoRate) Name

func (t GetCryptoRate) Name() string

type Result

type Result struct {
	Answer  string `json:"Answer"`
	Results []struct {
		Height    int    `json:"height"`
		Image     string `json:"image"`
		Source    string `json:"source"`
		Thumbnail string `json:"thumbnail"`
		Title     string `json:"title"`
		URL       string `json:"url"`
		Width     int    `json:"width"`
	} `json:"results"`
}

type SearXResult

type SearXResult struct {
	URL           string   `json:"url"`
	Title         string   `json:"title"`
	Content       string   `json:"content"`
	PublishedDate any      `json:"publishedDate,omitempty"`
	ImgSrc        any      `json:"img_src,omitempty"`
	Engine        string   `json:"engine"`
	ParsedURL     []string `json:"parsed_url"`
	Template      string   `json:"template"`
	Engines       []string `json:"engines"`
	Positions     []int    `json:"positions"`
	Score         float64  `json:"score"`
	Category      string   `json:"category"`
}

func SearchSearX

func SearchSearX(input string) ([]SearXResult, error)

type SearchParam

type SearchParam struct {
	Query     string
	Region    string
	ImageType string
}

func NewSearchImageParam

func NewSearchImageParam(query, region, imageType string) (*SearchParam, error)

func NewSearchParam

func NewSearchParam(query, region string) (*SearchParam, error)

type SearchResult

type SearchResult struct {
	Title   string
	Link    string
	Snippet string
	Image   string
}

type SearchVectorDB

type SearchVectorDB struct {
	CallbacksHandler callbacks.Handler
	SessionString    string
	Ollama           bool
}

SearchVectorDB is a tool that finds the most relevant documents in the vector db.

func (SearchVectorDB) Call

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

func (SearchVectorDB) Description

func (t SearchVectorDB) Description() string

func (SearchVectorDB) Name

func (t SearchVectorDB) Name() string

type WebSearch

type WebSearch struct {
	CallbacksHandler callbacks.Handler
	SessionString    string
	Ollama           bool
}

func (WebSearch) Call

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

func (WebSearch) Description

func (t WebSearch) Description() string

func (WebSearch) Name

func (t WebSearch) Name() string

Jump to

Keyboard shortcuts

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