refactor(gemini-live): bring tool-result handling in line with the canonical realtime pattern
Lays groundwork for cancel_on_interruption=False support on Gemini Live by restructuring _process_completed_function_calls to match the shape used by AWSNovaSonicLLMService and OpenAIRealtimeLLMService in #4441: a single-pass forward iteration over raw context messages that detects async-tool messages via async_tool_messages.parse_message and routes them — started skipped silently, intermediate logged-as-error and surfaced via push_error, final delivered via the formal FunctionResponse channel. Replaces the prior two-pass structure that went through the adapter for sync results — the service now uses a lightweight self._tool_call_id_to_name map (populated when the model issues tool calls) for the name lookup the adapter used to provide. Extracts a new GeminiLLMAdapter.to_function_response_dict static method for the dict-coercion logic that wraps non-dict tool returns as {value: <result>} for Gemini's FunctionResponse.response field; the adapter's existing inline copy in _from_standard_message uses it too. Example consolidation: - Folds realtime-gemini-live-function-calling.py into the base realtime-gemini-live.py example so the base exercises function calling out of the box (matching realtime-openai.py and realtime-aws-nova-sonic.py). - Renames realtime-gemini-live-vertex-function-calling.py to realtime-gemini-live-vertex.py, mirroring the consolidation. - Adds realtime-gemini-live-async-tool.py. - Updates scripts/evals/run-release-evals.py for the renames. This commit alone doesn't make cancel_on_interruption=False fully work on Gemini Live — additional investigation is pending. This is foundational work to be built on.
This commit is contained in:
@@ -223,12 +223,11 @@ TESTS_REALTIME = [
|
||||
# ("realtime/realtime-azure.py", EVAL_WEATHER),
|
||||
("realtime/realtime-openai-text.py", EVAL_WEATHER),
|
||||
("realtime/realtime-openai-live-video.py", EVAL_VISION_CAMERA),
|
||||
("realtime/realtime-gemini-live.py", EVAL_SIMPLE_MATH),
|
||||
("realtime/realtime-gemini-live.py", EVAL_WEATHER),
|
||||
("realtime/realtime-gemini-live-local-vad.py", EVAL_SIMPLE_MATH),
|
||||
("realtime/realtime-gemini-live-function-calling.py", EVAL_WEATHER),
|
||||
("realtime/realtime-gemini-live-video.py", EVAL_VISION_CAMERA),
|
||||
("realtime/realtime-gemini-live-google-search.py", EVAL_ONLINE_SEARCH),
|
||||
("realtime/realtime-gemini-live-vertex-function-calling.py", EVAL_WEATHER),
|
||||
("realtime/realtime-gemini-live-vertex.py", EVAL_WEATHER),
|
||||
("realtime/realtime-aws-nova-sonic.py", EVAL_SIMPLE_MATH),
|
||||
("realtime/realtime-ultravox.py", EVAL_ORDER),
|
||||
("realtime/realtime-grok.py", EVAL_WEATHER),
|
||||
|
||||
Reference in New Issue
Block a user