Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/dialog_providers/google.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions examples/dialog_providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions services/google-dialog/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
}
Expand Down Expand Up @@ -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 }),
}
}
Expand Down
5 changes: 4 additions & 1 deletion services/google-dialog/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions services/openai-dialog/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ impl Client {
)?;
}

output.service_event(OutputPath::Media, ServiceOutputEvent::TurnComplete)?;

#[cfg(feature = "prompt-delay")]
{
self.prompt_coordinator
Expand Down
1 change: 1 addition & 0 deletions services/openai-dialog/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ pub enum ServiceOutputEvent {
#[serde(skip_serializing_if = "Option::is_none")]
tools: Option<Vec<types::ToolDefinition>>,
},
TurnComplete,
}
Loading