Class SessionServiceGrpc.SessionServiceStub

java.lang.Object
io.grpc.stub.AbstractStub<S>
io.grpc.stub.AbstractAsyncStub<SessionServiceGrpc.SessionServiceStub>
com.google.cloud.ces.v1beta.SessionServiceGrpc.SessionServiceStub
Enclosing class:
SessionServiceGrpc

public static final class SessionServiceGrpc.SessionServiceStub extends io.grpc.stub.AbstractAsyncStub<SessionServiceGrpc.SessionServiceStub>
A stub to allow clients to do asynchronous rpc calls to service SessionService.
 Session service provides APIs for interacting with CES agents.
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class io.grpc.stub.AbstractStub

    io.grpc.stub.AbstractStub.StubFactory<T extends io.grpc.stub.AbstractStub<T>>
  • Method Summary

    Modifier and Type
    Method
    Description
    io.grpc.stub.StreamObserver<BidiSessionClientMessage>
    bidiRunSession(io.grpc.stub.StreamObserver<BidiSessionServerMessage> responseObserver)
    Establishes a bidirectional streaming connection with the CES agent.
    build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)
     
    void
    runSession(RunSessionRequest request, io.grpc.stub.StreamObserver<RunSessionResponse> responseObserver)
    Initiates a single-turn interaction with the CES agent within a session.
    void
    streamRunSession(RunSessionRequest request, io.grpc.stub.StreamObserver<RunSessionResponse> responseObserver)
    Initiates a single-turn interaction with the CES agent.

    Methods inherited from class io.grpc.stub.AbstractAsyncStub

    newStub, newStub

    Methods inherited from class io.grpc.stub.AbstractStub

    getCallOptions, getChannel, withCallCredentials, withChannel, withCompression, withDeadline, withDeadlineAfter, withDeadlineAfter, withExecutor, withInterceptors, withMaxInboundMessageSize, withMaxOutboundMessageSize, withOnReadyThreshold, withOption, withWaitForReady

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • build

      protected SessionServiceGrpc.SessionServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)
      Specified by:
      build in class io.grpc.stub.AbstractStub<SessionServiceGrpc.SessionServiceStub>
    • runSession

      public void runSession(RunSessionRequest request, io.grpc.stub.StreamObserver<RunSessionResponse> responseObserver)
       Initiates a single-turn interaction with the CES agent within a session.
       
    • streamRunSession

      public void streamRunSession(RunSessionRequest request, io.grpc.stub.StreamObserver<RunSessionResponse> responseObserver)
       Initiates a single-turn interaction with the CES agent. Uses server-side
       streaming to deliver incremental results and partial responses as they are
       generated.
       By default, complete responses (e.g., messages from callbacks or full LLM
       responses) are sent to the client as soon as they are available. To enable
       streaming individual text chunks directly from the model, set
       [enable_text_streaming][google.cloud.ces.v1beta.SessionConfig.enable_text_streaming]
       to true.
       
    • bidiRunSession

      public io.grpc.stub.StreamObserver<BidiSessionClientMessage> bidiRunSession(io.grpc.stub.StreamObserver<BidiSessionServerMessage> responseObserver)
       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.v1beta.BidiSessionClientMessage.config].
           For audio sessions, this should also include
           [InputAudioConfig][google.cloud.ces.v1beta.SessionConfig.input_audio_config]
           and
           [OutputAudioConfig][google.cloud.ces.v1beta.SessionConfig.output_audio_config]
           to define audio processing and synthesis parameters.
       2.  Interaction:
           Subsequent messages stream
           [SessionInput][google.cloud.ces.v1beta.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.v1beta.BidiSessionServerMessage.end_session]
           or [GoAway][google.cloud.ces.v1beta.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.v1beta.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.v1beta.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.v1beta.BidiSessionServerMessage.session_output]
           with
           [turn_completed][google.cloud.ces.v1beta.SessionOutput.turn_completed]
           set to true. This signals the end of the current turn and includes
           [DiagnosticInfo][google.cloud.ces.v1beta.SessionOutput.diagnostic_info]
           with execution details.
       --- Audio Best Practices ---
       1.  Streaming:
           Stream [audio data][google.cloud.ces.v1beta.SessionInput.audio]
           **CONTINUOUSLY**, even during silence. Recommended chunk size: 40-120ms
           (balances latency vs. efficiency).
       2.  Playback & Interruption:
           Play [audio responses][google.cloud.ces.v1beta.SessionOutput.audio]
           upon receipt. Stop playback immediately if an
           [InterruptionSignal][google.cloud.ces.v1beta.BidiSessionServerMessage.interruption_signal]
           is received (e.g., user barge-in or new agent response).