pet-ai/server/plugin/volcengine/model/request/llm.go

24 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package request
// Message 聊天消息结构体
type Message struct {
Role string `json:"role" form:"role" binding:"required"` // 角色: system, user, assistant
Content string `json:"content" form:"content" binding:"required"` // 消息内容
}
// ChatRequest 聊天请求结构体
type ChatRequest struct {
Messages []Message `json:"messages" form:"messages" binding:"required"` // 对话消息列表
Model string `json:"model" form:"model"` // 模型名称,如果为空则使用默认模型
Stream bool `json:"stream" form:"stream"` // 是否流式响应默认false
Temperature float64 `json:"temperature" form:"temperature"` // 温度参数控制随机性范围0-1
MaxTokens int `json:"max_tokens" form:"max_tokens"` // 最大生成token数
TopP float64 `json:"top_p" form:"top_p"` // 核采样参数
RequestID string `json:"request_id,omitempty" form:"request_id,omitempty"` // 请求ID用于流式响应管理
}
// StopRequest 停止生成请求结构体
type StopRequest struct {
RequestID string `json:"request_id" form:"request_id" binding:"required"` // 要停止的请求ID
}