litellm - ✅(Solved) Fix [Bug]: Dropped output_config parameter in Messages API prevents schema and effort constraints from being reflected in VertexAI Claude model responses [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23380Fetched 2026-04-08 00:37:08
View on GitHub
Comments
1
Participants
2
Timeline
17
Reactions
0
Timeline (top)
referenced ×6cross-referenced ×3labeled ×3subscribed ×2

Fix Action

Fixed

PR fix notes

PR #23396: fix: pass output_config for VertexAI Claude structured output

Description (problem / solution / changelog)

Summary

Pass output_config through to Vertex AI Claude so schema and effort constraints are reflected in model responses.

Root Cause

output_config was being dropped, preventing structured output (json_schema) from working with Vertex AI Claude.

Fix

Remove the line that drops output_config from the request.

Fixes #23380

Changed files

  • litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py (modified, +1/-2)

Code Example

response = client.messages.create(
    model="claude-opus-4.6",
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": "Extract the key information from this email: John Smith ([email protected]) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm.",
        }
    ],
    output_config={
        "format": {
            "type": "json_schema",
            "schema": {
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "email": {"type": "string"},
                    "plan_interest": {"type": "string"},
                    "demo_requested": {"type": "boolean"},
                },
                "required": ["name", "email", "plan_interest", "demo_requested"],
                "additionalProperties": False,
            },
        }
    },
)
print(response.content[0].text)

---
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When the output_config parameter is dropped during the request, the model fails to generate the expected structured response. Since the schema and effort constraints are not successfully transmitted to the model, they cannot influence the generation process or be reflected in the final output.

Steps to Reproduce

  1. Send a request to VertexAI Claude model to produce output in JSON schema:
response = client.messages.create(
    model="claude-opus-4.6",
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": "Extract the key information from this email: John Smith ([email protected]) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm.",
        }
    ],
    output_config={
        "format": {
            "type": "json_schema",
            "schema": {
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "email": {"type": "string"},
                    "plan_interest": {"type": "string"},
                    "demo_requested": {"type": "boolean"},
                },
                "required": ["name", "email", "plan_interest", "demo_requested"],
                "additionalProperties": False,
            },
        }
    },
)
print(response.content[0].text)
  1. Ensure the model returns valid JSON matching the schema passed in the request and not a string.

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.82.1

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To fix the issue of the model failing to generate the expected structured response when the output_config parameter is dropped, we need to ensure that the output_config is always provided in the request.

Here are the steps to fix the issue:

  • Check if output_config is provided before sending the request
  • If output_config is not provided, set a default output_config or raise an error

Example Code

def send_request(client, model, max_tokens, messages, output_config=None):
    if output_config is None:
        # Set a default output_config or raise an error
        output_config = {
            "format": {
                "type": "json_schema",
                "schema": {
                    "type": "object",
                    "properties": {
                        "name": {"type": "string"},
                        "email": {"type": "string"},
                        "plan_interest": {"type": "string"},
                        "demo_requested": {"type": "boolean"},
                    },
                    "required": ["name", "email", "plan_interest", "demo_requested"],
                    "additionalProperties": False,
                },
            }
        }
        # Alternatively, you can raise an error
        # raise ValueError("output_config is required")

    response = client.messages.create(
        model=model,
        max_tokens=max_tokens,
        messages=messages,
        output_config=output_config,
    )
    return response

# Example usage:
client =...  # Initialize the client
model = "claude-opus-4.6"
max_tokens = 1024
messages = [
    {
        "role": "user",
        "content": "Extract the key information from this email: John Smith ([email protected]) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm.",
    }
]

response = send_request(client, model, max_tokens, messages)
print(response.content[0].text)

Verification

To verify that the fix worked, you can check the response content to ensure it matches the expected JSON schema. You can also test the function with different input configurations to ensure it behaves as expected.

Extra Tips

  • Always validate user input to ensure it conforms to the expected format.
  • Consider adding error handling to handle cases where the output_config is invalid or missing.
  • Make sure to test the function thoroughly to ensure it works as expected in different scenarios.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: Dropped output_config parameter in Messages API prevents schema and effort constraints from being reflected in VertexAI Claude model responses [1 pull requests, 1 comments, 2 participants]