You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When executing the sample code, this error is always thrown: "ValueError: No stop reason found".
Steps to reproduce
importasynciofromautogen_ext.models.openaiimportOpenAIChatCompletionClientfromautogen_core.modelsimportUserMessage, ModelInfo, ModelFamilyclient=OpenAIChatCompletionClient(
model="deepseek-chat",
base_url="https://api.deepseek.com/v1",
api_key="sk-xxxxx",
model_info=ModelInfo(
vision=False,
function_calling=False,
json_output=False,
family=ModelFamily.UNKNOWN,
),
)
asyncdefmain():
messages= [
UserMessage(content="OUTPUT 1 only", source="user"),
]
# Create a stream.stream=client.create_stream(messages=messages)
# Iterate over the stream and print the responses.print("Streamed responses:")
asyncforresponseinstream: # type: ignoreifisinstance(response, str):
# A partial response is a string.print(response, flush=True, end="")
else:
# The last response is a CreateResult object with the complete message.print("\n\n------------\n")
print("The complete response:", flush=True)
print(response.content, flush=True)
print("\n\n------------\n")
print("The token usage was:", flush=True)
print(response.usage, flush=True)
if__name__=="__main__":
asyncio.run(main())
Model Used
deepseek-chat
Expected Behavior
execute normally
Screenshots and logs
No response
Additional Information
I found the place where the problem occurs. According to the code logic here, only when the usage is None and the stop_reason is also None will the finish_reason be set to the stop_reason. It's very strange why this is done.
Describe the bug
When executing the sample code, this error is always thrown: "ValueError: No stop reason found".
Steps to reproduce
Model Used
deepseek-chat
Expected Behavior
execute normally
Screenshots and logs
No response
Additional Information
I found the place where the problem occurs. According to the code logic here, only when the usage is None and the stop_reason is also None will the finish_reason be set to the stop_reason. It's very strange why this is done.
https://github.com/microsoft/autogen/blame/8a83262a905675f15dfca387ba4a8de7b6cf0635/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py#L695
The text was updated successfully, but these errors were encountered: