feat: add weather tools to legacy and Eino chat

This commit is contained in:
loveuer committed 2026-11-16 19:08:18 +08:00
1 parent 6e6171f481
commit 86e86bc9fa
18 files changed
+926 -77

No files matched your search

+4 -3
View File
@@ -2,9 +2,10 @@ package model
// ChatCompletionRequest 表示对话接口的请求参数。
type ChatCompletionRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Stream bool `json:"stream,omitempty"`
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Stream bool `json:"stream,omitempty"`
Tools []ToolDefinition `json:"tools,omitempty"`
}
// ChatCompletionResponse 表示对话接口的响应。
+1
View File
@@ -22,6 +22,7 @@ type ChatImageURL struct {
// ToolCall 表示模型请求执行的工具调用。
type ToolCall struct {
Index *int `json:"index,omitempty"`
ID string `json:"id"`
Type string `json:"type"`
Function ToolFunction `json:"function"`
+19
View File
@@ -0,0 +1,19 @@
package model
// ToolDefinition 描述可供模型调用的工具。
type ToolDefinition struct {
Type string `json:"type"`
Function ToolFunctionDefinition `json:"function"`
}
// ToolFunctionDefinition 包含工具名称、用途和参数的 JSON Schema。
type ToolFunctionDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]any `json:"parameters"`
}
// WeatherArguments 指定要查询当前天气的地点。
type WeatherArguments struct {
Location string `json:"location"`
}