mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Bug] Concat OpenaiSDK reasoning content (#2041)
* [Bug] Concat OpenaiSDK reasoning content * [Bug] Concat OpenaiSDK reasoning content * update * update
This commit is contained in:
parent
97010dc4ce
commit
e8bc8c1e8c
@ -661,18 +661,32 @@ class OpenAISDK(OpenAI):
|
|||||||
pass # noqa F841
|
pass # noqa F841
|
||||||
|
|
||||||
# Check if response is empty or content is empty
|
# Check if response is empty or content is empty
|
||||||
if not responses.choices or not responses.choices[
|
if (not responses.choices or not responses.choices[0].message
|
||||||
0].message.content:
|
or not responses.choices[0].message.content):
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
'API response is empty, it might be due to excessive '
|
'Failed to extract content from the responses. '
|
||||||
'input length or an internal server error '
|
'Please check the API response for detail information.'
|
||||||
'from your API provider.')
|
'API responses: %s',
|
||||||
|
responses,
|
||||||
|
)
|
||||||
num_retries += 1
|
num_retries += 1
|
||||||
# Continue to retry instead of returning empty response
|
# Continue to retry instead of returning empty response
|
||||||
continue
|
continue
|
||||||
# If the model has reasoning_content, concat it
|
|
||||||
# with the content
|
# Concat Reasoning Content and tags to content
|
||||||
if hasattr(responses.choices[0].message, 'reasoning_content'):
|
if (hasattr(responses.choices[0].message, 'reasoning_content')
|
||||||
|
and responses.choices[0].message.reasoning_content):
|
||||||
|
if self.verbose:
|
||||||
|
self.logger.info(
|
||||||
|
'Follow'
|
||||||
|
'vllm/reasoning/deepseek_r1_reasoning_parser'
|
||||||
|
'to parse the reasoning content and tags'
|
||||||
|
'Reasoning Content: %s, \n'
|
||||||
|
'Tags: %s, \n'
|
||||||
|
'Content: %s',
|
||||||
|
responses.choices[0].message.reasoning_content,
|
||||||
|
self.think_tag,
|
||||||
|
responses.choices[0].message.content)
|
||||||
return (responses.choices[0].message.reasoning_content +
|
return (responses.choices[0].message.reasoning_content +
|
||||||
self.think_tag +
|
self.think_tag +
|
||||||
responses.choices[0].message.content)
|
responses.choices[0].message.content)
|
||||||
|
Loading…
Reference in New Issue
Block a user