add jailbreak filter result, add ContentFilterResults on output (#864)
* add jailbreak filter result * add content filter results on completion output * add profanity content filter
This commit is contained in:
14
chat.go
14
chat.go
@@ -41,11 +41,23 @@ type Violence struct {
|
|||||||
Severity string `json:"severity,omitempty"`
|
Severity string `json:"severity,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type JailBreak struct {
|
||||||
|
Filtered bool `json:"filtered"`
|
||||||
|
Detected bool `json:"detected"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Profanity struct {
|
||||||
|
Filtered bool `json:"filtered"`
|
||||||
|
Detected bool `json:"detected"`
|
||||||
|
}
|
||||||
|
|
||||||
type ContentFilterResults struct {
|
type ContentFilterResults struct {
|
||||||
Hate Hate `json:"hate,omitempty"`
|
Hate Hate `json:"hate,omitempty"`
|
||||||
SelfHarm SelfHarm `json:"self_harm,omitempty"`
|
SelfHarm SelfHarm `json:"self_harm,omitempty"`
|
||||||
Sexual Sexual `json:"sexual,omitempty"`
|
Sexual Sexual `json:"sexual,omitempty"`
|
||||||
Violence Violence `json:"violence,omitempty"`
|
Violence Violence `json:"violence,omitempty"`
|
||||||
|
JailBreak JailBreak `json:"jailbreak,omitempty"`
|
||||||
|
Profanity Profanity `json:"profanity,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PromptAnnotation struct {
|
type PromptAnnotation struct {
|
||||||
@@ -340,6 +352,7 @@ type ChatCompletionChoice struct {
|
|||||||
// null: API response still in progress or incomplete
|
// null: API response still in progress or incomplete
|
||||||
FinishReason FinishReason `json:"finish_reason"`
|
FinishReason FinishReason `json:"finish_reason"`
|
||||||
LogProbs *LogProbs `json:"logprobs,omitempty"`
|
LogProbs *LogProbs `json:"logprobs,omitempty"`
|
||||||
|
ContentFilterResults ContentFilterResults `json:"content_filter_results,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChatCompletionResponse represents a response structure for chat completion API.
|
// ChatCompletionResponse represents a response structure for chat completion API.
|
||||||
@@ -351,6 +364,7 @@ type ChatCompletionResponse struct {
|
|||||||
Choices []ChatCompletionChoice `json:"choices"`
|
Choices []ChatCompletionChoice `json:"choices"`
|
||||||
Usage Usage `json:"usage"`
|
Usage Usage `json:"usage"`
|
||||||
SystemFingerprint string `json:"system_fingerprint"`
|
SystemFingerprint string `json:"system_fingerprint"`
|
||||||
|
PromptFilterResults []PromptFilterResult `json:"prompt_filter_results,omitempty"`
|
||||||
|
|
||||||
httpHeader
|
httpHeader
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user