Skip to content

feat: provider capability detection to prevent unsupported response_format / tool_call failures #6220

Description

@tcconnally

Problem

CrewAI's BaseLLM layer doesn't expose which features a provider supports (structured output, tool calling, reasoning, streaming). When a user configures response_format or uses tools with a provider that doesn't support them, the failure happens at the provider API level with a cryptic error:

  • DeepSeek: doesn't support response_format — user gets raw API error
  • Cerebras: thinking/reasoning behavior differs from OpenAI
  • Local models via Ollama: capabilities vary by model and quantization

This is related to PR #6171 which hardcodes {"deepseek"} as a provider that doesn't support response_format. This per-provider hardcoding approach doesn't scale.

Proposed Solution

  1. Add a ProviderCapabilities dataclass that each provider populates:

    @dataclass
    class ProviderCapabilities:
        supports_response_format: bool = True
        supports_tool_calling: bool = True
        supports_reasoning: bool = False
        supports_streaming: bool = True
        supports_image_input: bool = False
  2. In BaseLLM, check capabilities before making API calls and raise clear error messages like: "Provider deepseek does not support response_format. Use result_as_string=True or switch to a provider that supports structured output."

  3. Surface capabilities in the provider documentation

Impact

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions