[BugFix] anthropic/serving_messages: fix tool call arguments streaming (#34887)
Signed-off-by: Daniele Trifirò <dtrifiro@redhat.com> Co-authored-by: Nicolò Lucchesi <nlucches@redhat.com>
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user