mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix(gemini realtime): report barge-in as cancelled response.done Gemini/Vertex Live interruptions now close the cut-off item as incomplete and end with one response.done status=cancelled, reason=turn_detected, carrying the usage from Gemini's trailing turnComplete. Previously the interruption looked like a normal completion and a phantom second response.done held the tokens. Resolves LIT-9749. * fix(gemini realtime): close transcript-first items on barge-in A response opened by outputTranscription before any audio left the delta type unset, so a barge-in in that window never closed the item. Record the audio delta type when the transcript opens the item, which also closes it on generationComplete in a normal turn. Rewrite the test helper without mutation. * fix(gemini realtime): end the turn when generationComplete and turnComplete share a frame A frame carrying both flags took the generationComplete path only, so the item closed but response.done never fired. Route it to the turn end and close the open item there. Type the test helper with the real event types. * test(gemini realtime): type the interruption tests Annotate the added tests' parameters and locals (Final, -> None). * fix(gemini realtime): bill buffered interruption usage when the session closes If Gemini reports usage on the interrupted frame, that usage waits for the trailing turnComplete. A session that closes in between used to drop it, while main billed it on the interrupted frame's own response.done. Add an unbilled_response_on_session_close hook (None by default); Gemini returns the cancelled response.done carrying the buffered usage, and the realtime stream logs it at session close next to the transcription usage flush. * fix(gemini realtime): flush close-time usage only for an interrupted response Usage buffered from a tool call's trailing turnComplete or a standalone usage frame no longer becomes a never-created completed response.done at session close. Add an integration test: a real proxy and a scripted Vertex Live upstream, a session closed after the interrupted frame, and the spend row carrying that frame's usage. * test(realtime): read logged barge-in messages from the logging object instead of wrapping log_messages |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_gemini_realtime_transformation.py | ||