Gemini Enterprise for Customer Experience v1 API - Class SessionServiceClientImpl (1.0.0-beta01)

public sealed class SessionServiceClientImpl : SessionServiceClient

Reference documentation and code samples for the Gemini Enterprise for Customer Experience v1 API class SessionServiceClientImpl.

SessionService client wrapper implementation, for convenient use.

Inheritance

object > SessionServiceClient > SessionServiceClientImpl

Namespace

Google.Cloud.Ces.V1

Assembly

Google.Cloud.Ces.V1.dll

Remarks

Session service provides APIs for interacting with CES agents.

Constructors

SessionServiceClientImpl(SessionServiceClient, SessionServiceSettings, ILogger)

public SessionServiceClientImpl(SessionService.SessionServiceClient grpcClient, SessionServiceSettings settings, ILogger logger)

Constructs a client wrapper for the SessionService service, with the specified gRPC client and settings.

Parameters
Name Description
grpcClient SessionServiceSessionServiceClient

The underlying gRPC client.

settings SessionServiceSettings

The base SessionServiceSettings used within this client.

logger ILogger

Optional ILogger to use within this client.

Properties

GrpcClient

public override SessionService.SessionServiceClient GrpcClient { get; }

The underlying gRPC SessionService client

Property Value
Type Description
SessionServiceSessionServiceClient
Overrides

LocationsClient

public override LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient
Overrides

Methods

BidiRunSession(CallSettings, BidirectionalStreamingSettings)

public override SessionServiceClient.BidiRunSessionStream BidiRunSession(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Establishes a bidirectional streaming connection with the CES agent. The agent processes continuous multimodal inputs (e.g., text, audio) and generates real-time multimodal output streams.

--- Client Request Stream --- The client streams requests in the following order:

  1. Initialization: The first message must contain [SessionConfig][google.cloud.ces.v1.BidiSessionClientMessage.config]. For audio sessions, this should also include [InputAudioConfig][google.cloud.ces.v1.SessionConfig.input_audio_config] and [OutputAudioConfig][google.cloud.ces.v1.SessionConfig.output_audio_config] to define audio processing and synthesis parameters.

  2. Interaction: Subsequent messages stream [SessionInput][google.cloud.ces.v1.BidiSessionClientMessage.realtime_input] containing real-time user input data.

  3. Termination: The client should half-close the stream when there is no more user input. It should also half-close upon receiving [EndSession][google.cloud.ces.v1.BidiSessionServerMessage.end_session] or [GoAway][google.cloud.ces.v1.BidiSessionServerMessage.go_away] from the agent.

--- Server Response Stream --- For each interaction turn, the agent streams messages in the following sequence:

  1. Speech Recognition (First N messages): Contains [RecognitionResult][google.cloud.ces.v1.BidiSessionServerMessage.recognition_result] representing the concatenated user speech segments captured so far. This is only populated for audio sessions.

  2. Response (Next M messages): Contains [SessionOutput][google.cloud.ces.v1.BidiSessionServerMessage.session_output] delivering the agent's response in various modalities (e.g., text, audio).

  3. Turn Completion (Final message of the turn): Contains [SessionOutput][google.cloud.ces.v1.BidiSessionServerMessage.session_output] with [turn_completed][google.cloud.ces.v1.SessionOutput.turn_completed] set to true. This signals the end of the current turn and includes [DiagnosticInfo][google.cloud.ces.v1.SessionOutput.diagnostic_info] with execution details.

--- Audio Best Practices ---

  1. Streaming: Stream [audio data][google.cloud.ces.v1.SessionInput.audio] CONTINUOUSLY, even during silence. Recommended chunk size: 40-120ms (balances latency vs. efficiency).

  2. Playback & Interruption: Play [audio responses][google.cloud.ces.v1.SessionOutput.audio] upon receipt. Stop playback immediately if an [InterruptionSignal][google.cloud.ces.v1.BidiSessionServerMessage.interruption_signal] is received (e.g., user barge-in or new agent response).

Parameters
Name Description
callSettings CallSettings

If not null, applies overrides to this RPC call.

streamingSettings BidirectionalStreamingSettings

If not null, applies streaming overrides to this RPC call.

Returns
Type Description
SessionServiceClientBidiRunSessionStream

The client-server stream.

Overrides

RunSession(RunSessionRequest, CallSettings)

public override RunSessionResponse RunSession(RunSessionRequest request, CallSettings callSettings = null)

Initiates a single turn interaction with the CES agent within a session.

Parameters
Name Description
request RunSessionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RunSessionResponse

The RPC response.

Overrides

RunSessionAsync(RunSessionRequest, CallSettings)

public override Task<RunSessionResponse> RunSessionAsync(RunSessionRequest request, CallSettings callSettings = null)

Initiates a single turn interaction with the CES agent within a session.

Parameters
Name Description
request RunSessionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRunSessionResponse

A Task containing the RPC response.

Overrides