Skip to content

Reformat tool results for Anthropic AI #17669

@RulaKhaled

Description

@RulaKhaled

For Anthropic AI the input messages of the last span include the tool result as user message:

{
  role: user
  content: [
    {
      content: {"weather":"rainy"},
      tool_use_id: toolu_01MwJbFpWUHzzHsFHhimqQmq,
      type: tool_result
    }
  ],
}

though we would ideally get something like this:

{
  "role": "tool",
  "content": {
    "tool_use_id": "toolu_01MwJbFpWUHzzHsFHhimqQmq",
    "output": {"weather":"rainy"},
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions