Skip to content

Python: Anthropic provider does not normalize single tools #6901

Description

@VectorPeak

The Python Anthropic provider prepares tools by iterating options[tools] directly. Core ChatOptions accepts either a single tool or a sequence of tools, so passing a single FunctionTool currently raises TypeError before the request is sent, while passing a single dict tool is treated as dictionary keys instead of one tool specification.

Repro summary:

  • tools= -> TypeError: 'FunctionTool' object is not iterable
  • tools= -> {'tools': ['type', 'name', 'description']}
  • tools=[...] works as expected

Expected behavior:
The Anthropic provider should normalize the framework-level tools input before applying Anthropic-specific tool conversion, matching the behavior of other Python providers and core tool handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonUsage: [Issues, PRs], Target: PythontriageUsage: [Issues], Target: All issues that still need to be triaged

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions