Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a spelling error in the deserialization of the message returned when the completions API triggers the content filter. #23936

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/ai/azopenai/client_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func newContentFilterResponseError(resp *http.Response) error {
var envelope *struct {
Error struct {
InnerError struct {
ContentFilterResults *ContentFilterResults `json:"content_filter_result"`
} `json:"innererror"`
ContentFilterResults *ContentFilterResults `json:"content_filter_results"`
} `json:"inner_error"`
}
}

Expand Down
29 changes: 14 additions & 15 deletions sdk/ai/azopenai/testdata/content_filter_response_error.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{
"error": {
"message": "The response was filtered due to the prompt triggering Azure OpenAI’s content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766",
"type": null,
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"inner_error": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
"content_filter_results": {
"sexual": {
"filtered": true,
"severity": "medium"
},
"violence": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"hate": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"self_harm": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": true,
"severity": "medium"
}
}
}
},
"code": "content_filter",
"message": "The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: \r\nhttps://go.microsoft.com/fwlink/?linkid=2198766.",
"param": "prompt",
"type": null
}
}
4 changes: 2 additions & 2 deletions sdk/ai/azopenaiextensions/custom_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func ExtractContentFilterError(err error, contentFilterErr **ContentFilterError)
Status int `json:"status"`
InnerError struct {
Code string `json:"code"`
ContentFilterResults ContentFilterResultDetailsForPrompt `json:"content_filter_result"`
} `json:"innererror"`
ContentFilterResults ContentFilterResultDetailsForPrompt `json:"content_filter_results"`
} `json:"inner_error"`
} `json:"error"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"param": "prompt",
"code": "content_filter",
"status": 400,
"innererror": {
"inner_error": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_result": {
"hate": {
Expand Down
Loading