Unverified Commit 4a9c07a0 authored by Daniele's avatar Daniele Committed by GitHub
Browse files

[BugFix] anthropic/serving_messages: fix tool call arguments streaming (#34887)


Signed-off-by: default avatarDaniele Trifirò <dtrifiro@redhat.com>
Co-authored-by: default avatarNicolò Lucchesi <nlucches@redhat.com>
parent 9d379410
...@@ -432,6 +432,19 @@ class AnthropicServingMessages(OpenAIServingChat): ...@@ -432,6 +432,19 @@ class AnthropicServingMessages(OpenAIServingChat):
data = chunk.model_dump_json(exclude_unset=True) data = chunk.model_dump_json(exclude_unset=True)
yield wrap_data_with_event(data, "content_block_start") yield wrap_data_with_event(data, "content_block_start")
content_block_started = True content_block_started = True
if tool_call.function and tool_call.function.arguments:
chunk = AnthropicStreamEvent(
index=content_block_index,
type="content_block_delta",
delta=AnthropicDelta(
type="input_json_delta",
partial_json=tool_call.function.arguments,
),
)
data = chunk.model_dump_json(exclude_unset=True)
yield wrap_data_with_event(
data, "content_block_delta"
)
else: else:
chunk = AnthropicStreamEvent( chunk = AnthropicStreamEvent(
......
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