mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
fix(decisions): count a state nested past the depth limit as no text, so its byte drops keep main's error
This commit is contained in:
parent
45d80099a8
commit
691b35c5f5
2 changed files with 4 additions and 4 deletions
|
|
@ -262,7 +262,7 @@ def _holds_no_text(value: object, depth: int = 0) -> bool:
|
|||
if isinstance(value, str):
|
||||
return not value.strip()
|
||||
if depth >= DEFAULT_MAX_RECURSE_DEPTH:
|
||||
return False
|
||||
return True
|
||||
if _is_json_object(value):
|
||||
return all(_holds_no_text(item, depth + 1) for name, item in value.items() if name != "type")
|
||||
if _is_json_array(value):
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ def _nested_once(inner: object, _: int) -> object:
|
|||
return [inner]
|
||||
|
||||
|
||||
def test_input_has_no_text_stops_walking_a_state_nested_past_the_stack() -> None:
|
||||
deepest_state: Final = reduce(_nested_once, range(sys.getrecursionlimit() * 2), "")
|
||||
def test_input_has_no_text_counts_a_state_nested_past_the_stack_as_no_text() -> None:
|
||||
deepest_state: Final = reduce(_nested_once, range(sys.getrecursionlimit() * 2), "Product photo")
|
||||
|
||||
assert input_has_no_text(DecisionsIRState(state=deepest_state, images=())) is False
|
||||
assert input_has_no_text(DecisionsIRState(state=deepest_state, images=())) is True
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue