[Fix] Add Content_filter Error Case in openai_api.py#2167
Merged
tonysy merged 1 commit intoopen-compass:mainfrom Jul 1, 2025
Merged
[Fix] Add Content_filter Error Case in openai_api.py#2167tonysy merged 1 commit intoopen-compass:mainfrom
tonysy merged 1 commit intoopen-compass:mainfrom
Conversation
tonysy
reviewed
Jul 1, 2025
| 'and stop reason is <stop>, ' | ||
| 'the input query is: %s', query_data) | ||
| return '' | ||
| if responses.choices[0].finish_reason == 'content_filter': |
Collaborator
There was a problem hiding this comment.
Which API may cause this reason? You'd better add comments (with doc url or something else) to improve the readability.
Collaborator
There was a problem hiding this comment.
Also, it would be better to replace all empty returns with OC_API_ERROR_CODE. We can maintain a mapping dictionary, and return the ERROR code string to help locate the bug.
An example:
OC_API_ERROR_CODE_MAPS = {
"OC_API_ERROR_CODE: 01" : "xxx",
"OC_API_ERROR_CODE: 02" : "xxx",
}
Collaborator
Author
There was a problem hiding this comment.
It is hard to handle all error case with ERROR_MAP. So it would be better to maintain the status quo.
TBR
zyc140345
pushed a commit
to zyc140345/opencompass
that referenced
this pull request
Oct 23, 2025
iamkaia
pushed a commit
to iamkaia/opencompass
that referenced
this pull request
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.