mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-01 01:18:34 +00:00
* refactor(typing): clear basedpyright Any errors (wave 1) * refactor(typing): clear basedpyright Any errors (wave 2) * refactor(typing): clear basedpyright Any errors (wave 3) * refactor(typing): clear basedpyright Any errors (wave 4) * refactor(typing): clear basedpyright Any errors (wave 5) * refactor(typing): clear basedpyright Any errors (wave 6) * fix(typing): keep the cached-plan fallback's direct query_first calls so span naming resolves * fix(logging): keep callbacks running when litellm_params is a params model should_run_callback and the sync success and failure handlers read litellm_params through any object with a get method again, as they did before this branch, so a logging hook that returns a GenericLiteLLMParams no longer stops sync logging for that request Adds behavior tests for the changed lines codecov listed as not run * fix: read the regional uplift for every data residency again and reuse one dict TypeAdapter The typed lookup only read the eu and us multipliers, so a deployment that set regional_processing_uplift_multiplier_fedramp stopped applying it. /model/update and the model write paths now share one module-level TypeAdapter instead of building one per call. * fix: bill regional uplift multipliers float() accepts, bytes included * fix: raise the in operator's own error from one shared json_contains, and name the bad uplift type
18 lines
579 B
Python
18 lines
579 B
Python
from typing import Final
|
|
|
|
import pytest
|
|
|
|
from litellm.llms.cohere.common_utils import ModelResponseIterator
|
|
|
|
|
|
def test_stream_parses_object_chunks_and_rejects_a_chunk_that_is_not_an_object() -> None:
|
|
stream: Final = ModelResponseIterator(
|
|
streaming_response=iter(['{"text": "Hi", "index": 1}', "[1, 2]"]),
|
|
sync_stream=True,
|
|
)
|
|
|
|
first: Final = next(stream)
|
|
|
|
assert (first["text"], first["index"], first["is_finished"]) == ("Hi", 1, False)
|
|
with pytest.raises(AttributeError, match=r"^'list' object has no attribute 'get'$"):
|
|
next(stream)
|