Include chat, weather, image, travel, streaming ASR and text examples, shared model initialization, documentation, and existing tests. Co-authored-by: TRAE CLI <traecli@bytedance.com>
28 lines
896 B
Go
28 lines
896 B
Go
package model
|
|
|
|
// ChatCompletionRequest 表示对话接口的请求参数。
|
|
type ChatCompletionRequest struct {
|
|
Model string `json:"model"`
|
|
Messages []ChatMessage `json:"messages"`
|
|
Stream bool `json:"stream,omitempty"`
|
|
Tools []ToolDefinition `json:"tools,omitempty"`
|
|
}
|
|
|
|
// ChatCompletionResponse 表示对话接口的响应。
|
|
type ChatCompletionResponse struct {
|
|
Choices []ChatCompletionChoice `json:"choices"`
|
|
}
|
|
|
|
// ChatCompletionChoice 表示模型返回的一个候选回答。
|
|
type ChatCompletionChoice struct {
|
|
Message ChatMessage `json:"message"`
|
|
Delta ChatCompletionDelta `json:"delta"`
|
|
FinishReason string `json:"finish_reason"`
|
|
}
|
|
|
|
// ChatCompletionDelta 表示流式响应中的增量内容。
|
|
type ChatCompletionDelta struct {
|
|
Content string `json:"content"`
|
|
ToolCalls []ToolCall `json:"tool_calls"`
|
|
}
|