feat: xunfei support functions

This commit is contained in:
MartialBE
2024-01-02 22:40:47 +08:00
committed by Buer
parent 3b8ae9a6cd
commit e052009eba
4 changed files with 95 additions and 30 deletions

View File

@@ -7,30 +7,45 @@ type XunfeiMessage struct {
Content string `json:"content"`
}
type XunfeiChatPayloadMessage struct {
Text []XunfeiMessage `json:"text"`
}
type XunfeiChatPayloadFunctions struct {
Text []*types.ChatCompletionFunction `json:"text"`
}
type XunfeiChatPayload struct {
Message XunfeiChatPayloadMessage `json:"message"`
Functions *XunfeiChatPayloadFunctions `json:"functions,omitempty"`
}
type XunfeiParameterChat struct {
Domain string `json:"domain,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopK int `json:"top_k,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Auditing bool `json:"auditing,omitempty"`
}
type XunfeiChatRequestParameter struct {
Chat XunfeiParameterChat `json:"chat"`
}
type XunfeiChatRequest struct {
Header struct {
AppId string `json:"app_id"`
} `json:"header"`
Parameter struct {
Chat struct {
Domain string `json:"domain,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopK int `json:"top_k,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Auditing bool `json:"auditing,omitempty"`
} `json:"chat"`
} `json:"parameter"`
Payload struct {
Message struct {
Text []XunfeiMessage `json:"text"`
} `json:"message"`
} `json:"payload"`
Parameter XunfeiChatRequestParameter `json:"parameter"`
Payload XunfeiChatPayload `json:"payload"`
}
type XunfeiChatResponseTextItem struct {
Content string `json:"content"`
Role string `json:"role"`
Index int `json:"index"`
Content string `json:"content"`
Role string `json:"role"`
Index int `json:"index"`
ContentType string `json:"content_type,omitempty"`
FunctionCall *types.ChatCompletionToolCallsFunction `json:"function_call,omitempty"`
}
type XunfeiChatResponse struct {