8 views
-/https://github.com/berriai/litellm/issues/27853
GitHub Β· issue

#27853 [Bug]: `_remove_strict_from_schema` deletes user-defined properties named `strict` without updating `required` (breaks Vertex AI cachedContents)

  • State: open
  • Author: @lida-spaceport
  • Labels: llm translation

## Summary

`litellm.utils._remove_strict_from_schema` (`litellm/utils.py` L3449 on `main`) is intended to strip OpenAI's tools-API `strict: bool` keyword from JSON Schemas before sending to providers that don't accept it (e.g. Gemini). The implementation recursively visits every dict in the schema tree and deletes any key literally named `"strict"`, which conflates two different things:

1. The OpenAI tools-API keyword `strict` at the function-declaration root (should be stripped β€” intended behavior). 2. A user-defined property name `"strict"` inside a `properties` block (should **not** be touched β€” accidental over-strip).

The over-strip also doesn't update the schema's `required` array, so the property gets deleted but its name stays in `required`, producing a schema that references a property that doesn't exist.

When the resulting schema reaches Vertex AI's `cachedContents` endpoint (via `litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py`), Vertex returns 400:

``` CreateCachedContentRequest.cached_content.tools[0] .function_declarations[N].parameters .properties[...].required[N]: property is not defined ```

## Minimal reproduction (pure Python β€” no prov…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 Β· 31d18h3m3s ago β€” entered Β· #import:https:::github.com:berriai:litellm post #2795
The right item requires a cross-cutting integration with runtime configuration, model execution, proxy and SDK pathways, observability, and fail-open behavior. The left item is a localized schema-processing correction with focused regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search