Files
example-eino/pkg/model/chat.go
T

27 lines
835 B
Go

package model
// ChatCompletionRequest 表示对话接口的请求参数。
type ChatCompletionRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Stream bool `json:"stream,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"`
}