diff --git a/examples/dialog_providers/google.rs b/examples/dialog_providers/google.rs index 58fb4ce..91e2d57 100644 --- a/examples/dialog_providers/google.rs +++ b/examples/dialog_providers/google.rs @@ -59,6 +59,10 @@ impl ProviderApi for GoogleProvider { call_id, arguments: Some(arguments), })), + ServiceOutputEvent::TurnComplete => { + tracing::info!("Turn complete"); + Ok(None) + } ServiceOutputEvent::ToolCallCancellation { call_id } => { tracing::info!("Tool call cancelled: {call_id}"); Ok(None) diff --git a/examples/dialog_providers/openai.rs b/examples/dialog_providers/openai.rs index 3ed024b..a8915fd 100644 --- a/examples/dialog_providers/openai.rs +++ b/examples/dialog_providers/openai.rs @@ -61,6 +61,10 @@ impl ProviderApi for OpenAIProvider { call_id, arguments, })), + OpenAIServiceOutputEvent::TurnComplete => { + tracing::info!("Turn complete"); + Ok(None) + } OpenAIServiceOutputEvent::SessionUpdated { tools } => { tracing::info!("Session updated: {tools:?}"); Ok(None) diff --git a/services/google-dialog/src/client.rs b/services/google-dialog/src/client.rs index 1c12fcb..955829c 100644 --- a/services/google-dialog/src/client.rs +++ b/services/google-dialog/src/client.rs @@ -160,10 +160,10 @@ impl Client { ServerEvent::GenerationComplete => {} ServerEvent::TurnComplete => { self.finalize_output_transcription(text_outputs, output, state)?; - output.request_completed(None)?; + output.service_event(OutputPath::Media, ServiceOutputEvent::TurnComplete)?; } ServerEvent::Interrupted => { - // We expect a TurnComplete afterwards, so don't finalize the output transcription + // We expect a TurnComplete afterward, so don't finalize the output transcription // when interrupted. output.clear_audio()?; } @@ -277,7 +277,7 @@ impl Client { fn normalize_function_response(output: serde_json::Value) -> serde_json::Value { match output { serde_json::Value::Object(_) => output, - // Gemini requires `functionResponse.response` to be a protobuf struct, i.e. a JSON object. + // Gemini requires `functionResponse.response` to be a JSON object. value => serde_json::json!({ "result": value }), } } diff --git a/services/google-dialog/src/types.rs b/services/google-dialog/src/types.rs index 935fee8..c55f188 100644 --- a/services/google-dialog/src/types.rs +++ b/services/google-dialog/src/types.rs @@ -183,7 +183,10 @@ pub enum ServiceOutputEvent { arguments: serde_json::Value, }, #[serde(rename_all = "camelCase")] - ToolCallCancellation { call_id: String }, + ToolCallCancellation { + call_id: String, + }, + TurnComplete, } #[cfg(test)] diff --git a/services/openai-dialog/src/client.rs b/services/openai-dialog/src/client.rs index 90756f1..667b804 100644 --- a/services/openai-dialog/src/client.rs +++ b/services/openai-dialog/src/client.rs @@ -667,6 +667,8 @@ impl Client { )?; } + output.service_event(OutputPath::Media, ServiceOutputEvent::TurnComplete)?; + #[cfg(feature = "prompt-delay")] { self.prompt_coordinator diff --git a/services/openai-dialog/src/types.rs b/services/openai-dialog/src/types.rs index 73b737d..4b07e12 100644 --- a/services/openai-dialog/src/types.rs +++ b/services/openai-dialog/src/types.rs @@ -76,4 +76,5 @@ pub enum ServiceOutputEvent { #[serde(skip_serializing_if = "Option::is_none")] tools: Option>, }, + TurnComplete, }