Help us shape the future of Go! Take the 2026 Go Developer Survey

builtin

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package builtin 提供框架内置的工具(如 get_weather)。

内置工具与业务解耦:All() 汇总全部工具供统一注册。新增内置工具时,在本包 新建一个文件实现该工具,并把它的构造函数追加到 All(),即可自动接入各 Provider 的 tool-call 链路,无需改动上层注册逻辑。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() []tool.Tool

All 返回框架内置的全部工具。新增内置工具时在此追加。

func GetWeather

func GetWeather() tool.Tool

GetWeather 返回一个「获取天气」工具(当前返回模拟数据,供演示 / 联调)。

同一城市返回确定的温度,便于测试断言。后续接入真实天气服务时,只需替换 mockWeather 的内部实现,工具定义与签名保持不变。

Types

type GetWeatherInput

type GetWeatherInput struct {
	City string `json:"city"` // 城市名(必填)
	Unit string `json:"unit"` // 温度单位:celsius / fahrenheit,默认 celsius
}

GetWeatherInput 是 get_weather 工具的入参。

type GetWeatherOutput

type GetWeatherOutput struct {
	City        string  `json:"city"`
	Temperature float64 `json:"temperature"`
	Unit        string  `json:"unit"`
	Condition   string  `json:"condition"`
	Humidity    int     `json:"humidity"`
}

GetWeatherOutput 是 get_weather 工具的返回。

Jump to

Keyboard shortcuts

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