mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
fix: annotate anyOf list construction for the LIT002 budget
This commit is contained in:
parent
3bd5b6d60f
commit
dd897e571d
1 changed files with 3 additions and 1 deletions
|
|
@ -854,7 +854,9 @@ def convert_anyof_null_to_nullable(schema, depth=0):
|
|||
anyof: Final = schema.get("anyOf", None)
|
||||
if anyof is not None:
|
||||
contains_null: Final = any(isinstance(atype, dict) and atype.get("type") == "null" for atype in anyof)
|
||||
remaining: Final = [atype for atype in anyof if not (isinstance(atype, dict) and atype.get("type") == "null")]
|
||||
remaining: Final = [ # mutable-ok: anyOf must stay a list for downstream schema consumers
|
||||
atype for atype in anyof if not (isinstance(atype, dict) and atype.get("type") == "null")
|
||||
]
|
||||
|
||||
if len(remaining) == 0:
|
||||
# Edge case: response schema with only null type present is invalid in Vertex AI
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue