Unverified Commit 354cd580 authored by cdpath's avatar cdpath Committed by GitHub
Browse files

fix(anthropic): remove non-standard 'data: [DONE]' from Anthropic streaming (#37510)


Signed-off-by: default avatarcdpath <cdpath@outlook.com>
parent d49f2731
...@@ -576,7 +576,6 @@ class AnthropicServingMessages(OpenAIServingChat): ...@@ -576,7 +576,6 @@ class AnthropicServingMessages(OpenAIServingChat):
exclude_unset=True, exclude_none=True exclude_unset=True, exclude_none=True
) )
yield wrap_data_with_event(data, "message_stop") yield wrap_data_with_event(data, "message_stop")
yield "data: [DONE]\n\n"
else: else:
origin_chunk = ChatCompletionStreamResponse.model_validate_json( origin_chunk = ChatCompletionStreamResponse.model_validate_json(
data_str data_str
...@@ -773,7 +772,6 @@ class AnthropicServingMessages(OpenAIServingChat): ...@@ -773,7 +772,6 @@ class AnthropicServingMessages(OpenAIServingChat):
) )
data = error_response.model_dump_json(exclude_unset=True) data = error_response.model_dump_json(exclude_unset=True)
yield wrap_data_with_event(data, "error") yield wrap_data_with_event(data, "error")
yield "data: [DONE]\n\n"
except Exception as e: except Exception as e:
logger.exception("Error in message stream converter.") logger.exception("Error in message stream converter.")
...@@ -783,7 +781,6 @@ class AnthropicServingMessages(OpenAIServingChat): ...@@ -783,7 +781,6 @@ class AnthropicServingMessages(OpenAIServingChat):
) )
data = error_response.model_dump_json(exclude_unset=True) data = error_response.model_dump_json(exclude_unset=True)
yield wrap_data_with_event(data, "error") yield wrap_data_with_event(data, "error")
yield "data: [DONE]\n\n"
async def count_tokens( async def count_tokens(
self, self,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment