Skip to content

[BUG] Structured output failing for LiteLLM model run with azure provider #1076

@piotrkubicki

Description

@piotrkubicki

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

1.13.0

Python Version

3.11.0

Operating System

macOS 15.6

Installation Method

pip

Steps to Reproduce

from strands import Agent
from strands.models.litellm import LiteLLMModel
from pydantic import BaseModel


model = LiteLLMModel(
    model_id="azure/<your-deployment>",
    client_args={
        "api_key": "<your-token>",
        "api_base": "<azure-endpoint>",
    }
)


agent = Agent(model=model)


class UserInfo(BaseModel):
    Username: str
    Location: int


result = agent.structured_output(UserInfo, "Extract user information from the following text: 'My username is john_doe and I live in Madrid.'")
print(result)

install strands-agents with litellm

run the above code

Expected Behavior

The code should run successful, and return response with provided structure.

Actual Behavior

The code fail with this error
litellm.exceptions.BadRequestError: litellm.BadRequestError: AzureException BadRequestError - The 'stream_options' parameter is only allowed when 'stream' is enabled.

Additional Context

No response

Possible Solution

No response

Related Issues

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-providerRelated to model providersbugSomething isn't workingwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions