tools

package
v0.0.0-...-bd64846 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDishTool

func GetDishTool() tool.InvokableTool

func GetRestaurantTool

func GetRestaurantTool() tool.InvokableTool

Types

type Dish

type Dish struct {
	Name  string `json:"name"`
	Desc  string `json:"desc"`
	Price int    `json:"price"`
	Score int    `json:"score"`
}

type QueryDishesParam

type QueryDishesParam struct {
	RestaurantID string `json:"restaurant_id"`
	Topn         int    `json:"topn"`
}

type QueryRestaurantsParam

type QueryRestaurantsParam struct {
	Location string `json:"location"`
	Topn     int    `json:"topn"`
}

type Restaurant

type Restaurant struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Place string `json:"place"`
	Desc  string `json:"desc"`
	Score int    `json:"score"`
}

type ToolQueryDishes

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

ToolQueryDishes.

func (*ToolQueryDishes) Info

func (*ToolQueryDishes) InvokableRun

func (t *ToolQueryDishes) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...tool.Option) (string, error)

type ToolQueryRestaurants

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

func (*ToolQueryRestaurants) Info

func (*ToolQueryRestaurants) InvokableRun

func (t *ToolQueryRestaurants) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...tool.Option) (string, error)

InvokableRun tool 接收的参数和返回都是 string, 就如大模型的 tool call 的返回一样, 因此需要自行处理参数和结果的序列化. 返回的 content 会作为 schema.Message 的 content, 一般来说是作为大模型的输入, 因此处理成大模型能更好理解的结构最好. 因此,如果是 json 格式,就需要注意 key 和 value 的表意, 不要用 int Enum 代表一个业务含义,比如 `不要用 1 代表 male, 2 代表 female` 这类.

Jump to

Keyboard shortcuts

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