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:
co-authored by
Flora Feng
Nicolò Lucchesi
parent
e99ba957ec
commit
8d9babd4de
@@ -40,6 +40,7 @@ class AnthropicContentBlock(BaseModel):
|
|||||||
source: dict[str, Any] | None = None
|
source: dict[str, Any] | None = None
|
||||||
# For tool use/result
|
# For tool use/result
|
||||||
id: str | None = None
|
id: str | None = None
|
||||||
|
tool_use_id: str | None = None
|
||||||
name: str | None = None
|
name: str | None = None
|
||||||
input: dict[str, Any] | None = None
|
input: dict[str, Any] | None = None
|
||||||
content: str | list[dict[str, Any]] | None = None
|
content: str | list[dict[str, Any]] | None = None
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class AnthropicServingMessages(OpenAIServingChat):
|
|||||||
openai_messages.append(
|
openai_messages.append(
|
||||||
{
|
{
|
||||||
"role": "tool",
|
"role": "tool",
|
||||||
"tool_call_id": block.id or "",
|
"tool_call_id": block.tool_use_id or "",
|
||||||
"content": str(block.content)
|
"content": str(block.content)
|
||||||
if block.content
|
if block.content
|
||||||
else "",
|
else "",
|
||||||
|
|||||||
Reference in New Issue
Block a user