Fix empty tool_call_id in Anthropic messages API tool result conversion (#34745)
Signed-off-by: <> Signed-off-by: sfeng33 <4florafeng@gmail.com> Co-authored-by: Flora Feng <sfeng33@h100-01.nemg-001.lab.rdu2.dc.redhat.com> Co-authored-by: Nicolò Lucchesi <nlucches@redhat.com>
This commit is contained in:
@@ -40,6 +40,7 @@ class AnthropicContentBlock(BaseModel):
|
||||
source: dict[str, Any] | None = None
|
||||
# For tool use/result
|
||||
id: str | None = None
|
||||
tool_use_id: str | None = None
|
||||
name: str | None = None
|
||||
input: dict[str, Any] | None = None
|
||||
content: str | list[dict[str, Any]] | None = None
|
||||
|
||||
@@ -139,7 +139,7 @@ class AnthropicServingMessages(OpenAIServingChat):
|
||||
openai_messages.append(
|
||||
{
|
||||
"role": "tool",
|
||||
"tool_call_id": block.id or "",
|
||||
"tool_call_id": block.tool_use_id or "",
|
||||
"content": str(block.content)
|
||||
if block.content
|
||||
else "",
|
||||
|
||||
Reference in New Issue
Block a user