fix(responses): preserve usage estimate defaults

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
mateo 2026-10-26 21:40:25 +00:00
parent 7e85ceba27
commit 160729380b
2 changed files with 2 additions and 2 deletions

View file

@ -1751,7 +1751,7 @@ def _estimate_usage_from_text(
responses_api_request: Mapping[str, object],
generated_text: str,
*,
use_default_image_token_count: bool,
use_default_image_token_count: bool = False,
) -> ResponseAPIUsage:
messages: Final = LiteLLMCompletionResponsesConfig.transform_responses_api_input_to_messages( # pyright: ignore[reportUnknownMemberType] # the transformer's signature is partially untyped
input=request_input, # pyright: ignore[reportArgumentType] # the raw Responses API input is a str or ResponseInputParam list, matching the helper's declared union

View file

@ -1206,7 +1206,7 @@ async def test_completed_event_survives_a_failing_usage_estimate():
malformed_input: Final = [{"type": "message", "role": "user", "content": 42}]
with pytest.raises(ValueError, match="Invalid content type"):
_estimate_usage_from_text(
"gpt-4o-mini", malformed_input, {"input": malformed_input}, "hello world", use_default_image_token_count=False
"gpt-4o-mini", malformed_input, {"input": malformed_input}, "hello world"
)
response = _responses_api_response_without_usage()