mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-16 21:23:44 +08:00
✨ feat: xunfei support functions
This commit is contained in:
@@ -5,13 +5,24 @@ const (
|
||||
ContentTypeImageURL = "image_url"
|
||||
)
|
||||
|
||||
type ChatCompletionToolCallsFunction struct {
|
||||
Name string `json:"name"`
|
||||
Arguments string `json:"arguments"`
|
||||
}
|
||||
|
||||
type ChatCompletionToolCalls struct {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Function ChatCompletionToolCallsFunction `json:"function"`
|
||||
}
|
||||
|
||||
type ChatCompletionMessage struct {
|
||||
Role string `json:"role"`
|
||||
Content any `json:"content"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FunctionCall any `json:"function_call,omitempty"`
|
||||
ToolCalls any `json:"tool_calls,omitempty"`
|
||||
ToolCallID string `json:"tool_call_id,omitempty"`
|
||||
Role string `json:"role"`
|
||||
Content any `json:"content,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
FunctionCall *ChatCompletionToolCallsFunction `json:"function_call,omitempty"`
|
||||
ToolCalls []*ChatCompletionToolCalls `json:"tool_calls,omitempty"`
|
||||
ToolCallID string `json:"tool_call_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m ChatCompletionMessage) StringContent() string {
|
||||
@@ -112,12 +123,23 @@ type ChatCompletionRequest struct {
|
||||
FrequencyPenalty float64 `json:"frequency_penalty,omitempty"`
|
||||
LogitBias any `json:"logit_bias,omitempty"`
|
||||
User string `json:"user,omitempty"`
|
||||
Functions any `json:"functions,omitempty"`
|
||||
Functions []*ChatCompletionFunction `json:"functions,omitempty"`
|
||||
FunctionCall any `json:"function_call,omitempty"`
|
||||
Tools any `json:"tools,omitempty"`
|
||||
Tools []*ChatCompletionTool `json:"tools,omitempty"`
|
||||
ToolChoice any `json:"tool_choice,omitempty"`
|
||||
}
|
||||
|
||||
type ChatCompletionFunction struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Parameters any `json:"parameters"`
|
||||
}
|
||||
|
||||
type ChatCompletionTool struct {
|
||||
Type string `json:"type"`
|
||||
Function ChatCompletionFunction `json:"function"`
|
||||
}
|
||||
|
||||
type ChatCompletionChoice struct {
|
||||
Index int `json:"index"`
|
||||
Message ChatCompletionMessage `json:"message"`
|
||||
|
||||
Reference in New Issue
Block a user