|
@@ -34,6 +34,8 @@ type GeneralOpenAIRequest struct {
|
|
|
LogProbs bool `json:"logprobs,omitempty"`
|
|
LogProbs bool `json:"logprobs,omitempty"`
|
|
|
TopLogProbs int `json:"top_logprobs,omitempty"`
|
|
TopLogProbs int `json:"top_logprobs,omitempty"`
|
|
|
Dimensions int `json:"dimensions,omitempty"`
|
|
Dimensions int `json:"dimensions,omitempty"`
|
|
|
|
|
+ Modalities any `json:"modalities,omitempty"`
|
|
|
|
|
+ Audio any `json:"audio,omitempty"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type OpenAITools struct {
|
|
type OpenAITools struct {
|
|
@@ -83,9 +85,10 @@ type Message struct {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type MediaMessage struct {
|
|
type MediaMessage struct {
|
|
|
- Type string `json:"type"`
|
|
|
|
|
- Text string `json:"text"`
|
|
|
|
|
- ImageUrl any `json:"image_url,omitempty"`
|
|
|
|
|
|
|
+ Type string `json:"type"`
|
|
|
|
|
+ Text string `json:"text"`
|
|
|
|
|
+ ImageUrl any `json:"image_url,omitempty"`
|
|
|
|
|
+ InputAudio any `json:"input_audio,omitempty"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
type MessageImageUrl struct {
|
|
type MessageImageUrl struct {
|
|
@@ -93,9 +96,15 @@ type MessageImageUrl struct {
|
|
|
Detail string `json:"detail"`
|
|
Detail string `json:"detail"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+type MessageInputAudio struct {
|
|
|
|
|
+ Data string `json:"data"` //base64
|
|
|
|
|
+ Format string `json:"format"`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const (
|
|
const (
|
|
|
- ContentTypeText = "text"
|
|
|
|
|
- ContentTypeImageURL = "image_url"
|
|
|
|
|
|
|
+ ContentTypeText = "text"
|
|
|
|
|
+ ContentTypeImageURL = "image_url"
|
|
|
|
|
+ ContentTypeInputAudio = "input_audio"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func (m Message) StringContent() string {
|
|
func (m Message) StringContent() string {
|
|
@@ -168,11 +177,19 @@ func (m Message) ParseContent() []MediaMessage {
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ case ContentTypeInputAudio:
|
|
|
|
|
+ if subObj, ok := contentMap["input_audio"].(map[string]any); ok {
|
|
|
|
|
+ contentList = append(contentList, MediaMessage{
|
|
|
|
|
+ Type: ContentTypeInputAudio,
|
|
|
|
|
+ InputAudio: MessageInputAudio{
|
|
|
|
|
+ Data: subObj["data"].(string),
|
|
|
|
|
+ Format: subObj["format"].(string),
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return contentList
|
|
return contentList
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
return nil
|
|
return nil
|
|
|
}
|
|
}
|