Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: litellm.enable_json_schema_validation be converted to a per-call parameter instead of module level setting. #9036

Open
achpalaman opened this issue Mar 6, 2025 · 0 comments
Labels
enhancement New feature or request mlops user request

Comments

@achpalaman
Copy link

The Feature

Move enable_json_schema_validation from litellm.enable_json_schema_validation to a parameter provided to the completion( ) api.

Motivation, pitch

Currently, we must set litellm.enable_json_schema_validation = True to enable json schema validation.
This is very useful, because if schema validation fails, then LiteLLM will retry or fallback to other models.

We exploit this property by first trying with Claude, and falling back to GPT Structured Outputs if Claude fails to produce a schema matching the spec.

However, there are times when we want to disable this validation (when we have our own error correcting mechanism, or custom parser.) -- Unfortunately, since this isn't a parameter to the completion( ) API, it means we either have it for all requests, or None.

Are you a ML Ops Team?

Yes

Twitter / LinkedIn details

No response

@achpalaman achpalaman added the enhancement New feature or request label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mlops user request
Projects
None yet
Development

No branches or pull requests

1 participant