Add support for azure openai new version API (2023-07-01-preview) (#451)
This commit is contained in:
29
chat.go
29
chat.go
@@ -21,6 +21,35 @@ var (
|
|||||||
ErrChatCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateChatCompletionStream") //nolint:lll
|
ErrChatCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateChatCompletionStream") //nolint:lll
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Hate struct {
|
||||||
|
Filtered bool `json:"filtered"`
|
||||||
|
Severity string `json:"severity,omitempty"`
|
||||||
|
}
|
||||||
|
type SelfHarm struct {
|
||||||
|
Filtered bool `json:"filtered"`
|
||||||
|
Severity string `json:"severity,omitempty"`
|
||||||
|
}
|
||||||
|
type Sexual struct {
|
||||||
|
Filtered bool `json:"filtered"`
|
||||||
|
Severity string `json:"severity,omitempty"`
|
||||||
|
}
|
||||||
|
type Violence struct {
|
||||||
|
Filtered bool `json:"filtered"`
|
||||||
|
Severity string `json:"severity,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContentFilterResults struct {
|
||||||
|
Hate Hate `json:"hate,omitempty"`
|
||||||
|
SelfHarm SelfHarm `json:"self_harm,omitempty"`
|
||||||
|
Sexual Sexual `json:"sexual,omitempty"`
|
||||||
|
Violence Violence `json:"violence,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PromptAnnotation struct {
|
||||||
|
PromptIndex int `json:"prompt_index,omitempty"`
|
||||||
|
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type ChatCompletionMessage struct {
|
type ChatCompletionMessage struct {
|
||||||
Role string `json:"role"`
|
Role string `json:"role"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
|
|||||||
@@ -12,17 +12,19 @@ type ChatCompletionStreamChoiceDelta struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ChatCompletionStreamChoice struct {
|
type ChatCompletionStreamChoice struct {
|
||||||
Index int `json:"index"`
|
Index int `json:"index"`
|
||||||
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
|
Delta ChatCompletionStreamChoiceDelta `json:"delta"`
|
||||||
FinishReason FinishReason `json:"finish_reason"`
|
FinishReason FinishReason `json:"finish_reason"`
|
||||||
|
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatCompletionStreamResponse struct {
|
type ChatCompletionStreamResponse struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Object string `json:"object"`
|
Object string `json:"object"`
|
||||||
Created int64 `json:"created"`
|
Created int64 `json:"created"`
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Choices []ChatCompletionStreamChoice `json:"choices"`
|
Choices []ChatCompletionStreamChoice `json:"choices"`
|
||||||
|
PromptAnnotations []PromptAnnotation `json:"prompt_annotations,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChatCompletionStream
|
// ChatCompletionStream
|
||||||
|
|||||||
Reference in New Issue
Block a user