Gemini Enterprise for Customer Experience V1BETA API - Class Google::Cloud::Ces::V1beta::SessionService::Rest::Client (v1.3.0)

Reference documentation and code samples for the Gemini Enterprise for Customer Experience V1BETA API class Google::Cloud::Ces::V1beta::SessionService::Rest::Client.

REST client for the SessionService service.

Session service provides APIs for interacting with CES agents.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the SessionService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all SessionService clients
::Google::Cloud::Ces::V1beta::SessionService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#cancel_assistant_turn

def cancel_assistant_turn(request, options = nil) -> ::Google::Cloud::Ces::V1beta::CancelAssistantTurnResponse
def cancel_assistant_turn(name: nil, turn_id: nil) -> ::Google::Cloud::Ces::V1beta::CancelAssistantTurnResponse

Cancels the assistant session's in-flight turn, if any: the explicit user stop for a turn running detached from any stream. A cancel landing on a task that does not host the turn preempts it through the session turn epoch instead, ending it within one lease renewal.

Overloads
def cancel_assistant_turn(request, options = nil) -> ::Google::Cloud::Ces::V1beta::CancelAssistantTurnResponse
Pass arguments to cancel_assistant_turn via a request object, either of type CancelAssistantTurnRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Ces::V1beta::CancelAssistantTurnRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def cancel_assistant_turn(name: nil, turn_id: nil) -> ::Google::Cloud::Ces::V1beta::CancelAssistantTurnResponse
Pass arguments to cancel_assistant_turn via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The assistant session whose in-flight turn to cancel.
  • turn_id (::String) — Optional. The turn to cancel; empty cancels whichever turn is running. A cancel naming a turn that is no longer the running one is a no-op.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ces/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Ces::V1beta::CancelAssistantTurnRequest.new

# Call the cancel_assistant_turn method.
result = client.cancel_assistant_turn request

# The returned object is of type Google::Cloud::Ces::V1beta::CancelAssistantTurnResponse.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the SessionService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#generate_onboarding_suggestions

def generate_onboarding_suggestions(request, options = nil) -> ::Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsResponse
def generate_onboarding_suggestions(name: nil, max_suggestions: nil) -> ::Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsResponse

Generates personalized onboarding suggestions for the Arc zero state: classifies the requesting user (new / exploring / returning) from their assistant-session history in the app and returns suggestion chips (resume a session, continue work, or start something new) to render before any message is sent.

Overloads
def generate_onboarding_suggestions(request, options = nil) -> ::Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsResponse
Pass arguments to generate_onboarding_suggestions via a request object, either of type GenerateOnboardingSuggestionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def generate_onboarding_suggestions(name: nil, max_suggestions: nil) -> ::Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsResponse
Pass arguments to generate_onboarding_suggestions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The app whose zero state is being rendered. Format: projects/{project}/locations/{location}/apps/{app}
  • max_suggestions (::Integer) — Optional. Maximum number of suggestions to return. Defaults to 4 when unset.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ces/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsRequest.new

# Call the generate_onboarding_suggestions method.
result = client.generate_onboarding_suggestions request

# The returned object is of type Google::Cloud::Ces::V1beta::GenerateOnboardingSuggestionsResponse.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new SessionService REST client object.

Yields
  • (config) — Configure the SessionService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#run_session

def run_session(request, options = nil) -> ::Google::Cloud::Ces::V1beta::RunSessionResponse
def run_session(config: nil, inputs: nil) -> ::Google::Cloud::Ces::V1beta::RunSessionResponse

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

Overloads
def run_session(request, options = nil) -> ::Google::Cloud::Ces::V1beta::RunSessionResponse
Pass arguments to run_session via a request object, either of type RunSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Ces::V1beta::RunSessionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def run_session(config: nil, inputs: nil) -> ::Google::Cloud::Ces::V1beta::RunSessionResponse
Pass arguments to run_session via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ces/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Ces::V1beta::RunSessionRequest.new

# Call the run_session method.
result = client.run_session request

# The returned object is of type Google::Cloud::Ces::V1beta::RunSessionResponse.
p result

#stream_chat_ai_assistant

def stream_chat_ai_assistant(request, options = nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::StreamChatAiAssistantResponse>
def stream_chat_ai_assistant(name: nil, message: nil, attached_gcs_uris: nil, context_token: nil, confirmation_response: nil, client_capabilities: nil, operation_completed_event: nil, resume_from_sequence_number: nil, attach_only: nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::StreamChatAiAssistantResponse>

Runs Arc, the AI assistant, for the specified assistant session in a streaming fashion.

Overloads
def stream_chat_ai_assistant(request, options = nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::StreamChatAiAssistantResponse>
Pass arguments to stream_chat_ai_assistant via a request object, either of type Google::Cloud::Ces::V1beta::StreamChatAiAssistantRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Ces::V1beta::StreamChatAiAssistantRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def stream_chat_ai_assistant(name: nil, message: nil, attached_gcs_uris: nil, context_token: nil, confirmation_response: nil, client_capabilities: nil, operation_completed_event: nil, resume_from_sequence_number: nil, attach_only: nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::StreamChatAiAssistantResponse>
Pass arguments to stream_chat_ai_assistant via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The assistant session to be used to run the assistant. Format: projects/{project}/locations/{location}/apps/{app}/assistantSessions/{assistant_session}
  • message (::String) — Optional. The message to send to the assistant agent. May be empty when confirmation_response is set (answering a pending confirmation without adding a new message); at least one of the two must be provided.
  • attached_gcs_uris (::Array<::String>) — Optional. Cloud Storage URIs for files uploaded by the user during this turn. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
  • context_token (::String) — Optional. Opaque onboarding context token returned by SessionService.GenerateOnboardingSuggestions. When set and still fresh, the server reuses the onboarding snapshot computed for the zero state instead of recomputing it for the first conversation turn.
  • confirmation_response (::Google::Cloud::Ces::V1beta::AssistantConfirmationResponse, ::Hash) — Optional. The user's answer to a pending AssistantConfirmationRequest. When set, the server resumes the paused agent with this answer instead of (or in addition to) starting a new prompt turn.
  • client_capabilities (::Array<::Google::Cloud::Ces::V1beta::StreamChatAiAssistantRequest::ClientCapability>) — Optional. Response features this client can render. The server only emits events that need a capability (e.g. confirmation_request) when the capability is declared, so older clients never receive events they would silently drop.
  • operation_completed_event (::Google::Cloud::Ces::V1beta::OperationCompletedEvent, ::Hash) — Optional. Resumes an assistant session paused waiting for a client-managed long-running operation to complete.
  • resume_from_sequence_number (::Integer) — Optional. Optional cursor to resume and replay events from an in-flight or completed turn.
  • attach_only (::Boolean) — Optional. Optional flag to attach to an existing in-flight turn without submitting a new message.
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ces/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Ces::V1beta::StreamChatAiAssistantRequest.new

# Call the stream_chat_ai_assistant method to start streaming.
output = client.stream_chat_ai_assistant request

# The returned object is a streamed enumerable yielding elements of type
# ::Google::Cloud::Ces::V1beta::StreamChatAiAssistantResponse
output.each do |current_response|
  p current_response
end

#stream_run_session

def stream_run_session(request, options = nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::RunSessionResponse>
def stream_run_session(config: nil, inputs: nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::RunSessionResponse>

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 to true.

Overloads
def stream_run_session(request, options = nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::RunSessionResponse>
Pass arguments to stream_run_session via a request object, either of type RunSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Ces::V1beta::RunSessionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def stream_run_session(config: nil, inputs: nil) -> ::Enumerable<::Google::Cloud::Ces::V1beta::RunSessionResponse>
Pass arguments to stream_run_session via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ces/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Ces::V1beta::SessionService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Ces::V1beta::RunSessionRequest.new

# Call the stream_run_session method to start streaming.
output = client.stream_run_session request

# The returned object is a streamed enumerable yielding elements of type
# ::Google::Cloud::Ces::V1beta::RunSessionResponse
output.each do |current_response|
  p current_response
end

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)