[Bugfix][Frontend] Emit a content block for empty Anthropic completions (#46525)
Signed-off-by: EazyReal <8047065+EazyReal@users.noreply.github.com>
This commit is contained in:
@@ -665,6 +665,12 @@ class AnthropicServingMessages(OpenAIServingChat):
|
||||
)
|
||||
content += [anthropic_tool_call]
|
||||
|
||||
# Anthropic's canonical shape for an empty completion is a single
|
||||
# empty text block, not []. Some strict clients assume content[0]
|
||||
# exists, so emit one here.
|
||||
if not content:
|
||||
content.append(AnthropicContentBlock(type="text", text=""))
|
||||
|
||||
result.content = content
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user