mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix(anthropic_messages): key the first web search round's spend row by its own upstream reply A non-streaming /v1/messages request answered through websearch_interception logged its first model call with that call's usage but the follow-up reply's id, so both spend rows shared one request_id and the first was dropped by skip_duplicates. The logged row now takes its id and provider-reported cost from the same upstream body its usage is parsed from, falling back to the served id when that body has none. Refs #49651 * refactor(anthropic_messages): read the upstream reply id after reparsing it Drop the defensive body helper. transform_response already requires a read JSON body, so the upstream id and reported cost are now read after it succeeds, which leaves every existing failure path unchanged. Tests gain return annotations and use the current Sonnet model name. Refs #49651 * fix(anthropic_messages): key by the upstream reply only when a follow-up was served Keying every reparsed /v1/messages row by its upstream reply overrode an id a post-call deployment hook deliberately replaced. The anthropic agentic executor now records on the outer logging object that it served a follow-up's reply, and only then does that call's spend row take its id and reported cost from its own upstream reply. Refs #49651 * test(anthropic_messages): pin the agentic follow-up row test to a fixed start time Refs #49651 --------- Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_aiohttp_cleanup_closed.py | ||
| test_aiohttp_handler.py | ||
| test_aiohttp_so_keepalive.py | ||
| test_aiohttp_transport.py | ||
| test_asgi_handler.py | ||
| test_async_client_cleanup.py | ||
| test_container_handler.py | ||
| test_credential_leak_prevention.py | ||
| test_gemini_session_leak.py | ||
| test_http2_connection_spread.py | ||
| test_http_handler.py | ||
| test_llm_http_handler.py | ||
| test_mock_transport.py | ||
| test_sse_lines.py | ||