mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(responses): resolve basedpyright final assignment and mock logging handler stubs
This commit is contained in:
parent
eac6ab293f
commit
259821fbaa
2 changed files with 19 additions and 8 deletions
|
|
@ -1132,15 +1132,20 @@ class MockResponsesAPIStreamingIterator(BaseResponsesAPIStreamingIterator):
|
|||
call_type: str | None = None,
|
||||
transformed_response: ResponsesAPIResponse | None = None,
|
||||
):
|
||||
if transformed_response is not None:
|
||||
transformed: Final = transformed_response
|
||||
elif responses_api_provider_config is not None and response is not None:
|
||||
transformed: Final = responses_api_provider_config.transform_response_api_response(
|
||||
model=model,
|
||||
raw_response=response,
|
||||
logging_obj=logging_obj,
|
||||
transformed: Final[ResponsesAPIResponse | None] = (
|
||||
transformed_response
|
||||
if transformed_response is not None
|
||||
else (
|
||||
responses_api_provider_config.transform_response_api_response(
|
||||
model=model,
|
||||
raw_response=response,
|
||||
logging_obj=logging_obj,
|
||||
)
|
||||
if responses_api_provider_config is not None and response is not None
|
||||
else None
|
||||
)
|
||||
else:
|
||||
)
|
||||
if transformed is None:
|
||||
raise ValueError(
|
||||
"Either transformed_response or both responses_api_provider_config and response must be provided to MockResponsesAPIStreamingIterator"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -340,6 +340,12 @@ def test_mock_responses_streaming_iterator_validation_and_config_branches():
|
|||
def __init__(self):
|
||||
self.model_call_details = {"litellm_params": {"api_key": "fake"}}
|
||||
|
||||
async def async_success_handler(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def success_handler(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
logging_obj = _MockLoggingObj()
|
||||
iterator = MockResponsesAPIStreamingIterator(
|
||||
response=httpx.Response(200),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue