Vertex AI V1 API - Class Google::Cloud::AIPlatform::V1::SessionService::Rest::Client (v1.37.0)

Reference documentation and code samples for the Vertex AI V1 API class Google::Cloud::AIPlatform::V1::SessionService::Rest::Client.

REST client for the SessionService service.

The service that manages Vertex Session related resources.

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::AIPlatform::V1::SessionService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#append_event

def append_event(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::AppendEventResponse
def append_event(name: nil, event: nil) -> ::Google::Cloud::AIPlatform::V1::AppendEventResponse

Appends an event to a given session.

Overloads
def append_event(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::AppendEventResponse
Pass arguments to append_event via a request object, either of type AppendEventRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::AppendEventRequest, ::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 append_event(name: nil, event: nil) -> ::Google::Cloud::AIPlatform::V1::AppendEventResponse
Pass arguments to append_event 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 resource name of the session to append event to. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}
  • event (::Google::Cloud::AIPlatform::V1::SessionEvent, ::Hash) — Required. The event to append to the session.
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/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::AppendEventRequest.new

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

# The returned object is of type Google::Cloud::AIPlatform::V1::AppendEventResponse.
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

#create_session

def create_session(request, options = nil) -> ::Gapic::Operation
def create_session(parent: nil, session: nil) -> ::Gapic::Operation

Creates a new Session.

Overloads
def create_session(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_session via a request object, either of type CreateSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::CreateSessionRequest, ::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 create_session(parent: nil, session: nil) -> ::Gapic::Operation
Pass arguments to create_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
  • parent (::String) — Required. The resource name of the location to create the session in. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}
  • session (::Google::Cloud::AIPlatform::V1::Session, ::Hash) — Required. The session to create.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::CreateSessionRequest.new

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_session

def delete_session(request, options = nil) -> ::Gapic::Operation
def delete_session(name: nil) -> ::Gapic::Operation

Deletes details of the specific Session.

Overloads
def delete_session(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_session via a request object, either of type DeleteSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::DeleteSessionRequest, ::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 delete_session(name: nil) -> ::Gapic::Operation
Pass arguments to delete_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).
Parameter
  • name (::String) — Required. The resource name of the session. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::DeleteSessionRequest.new

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_session

def get_session(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Session
def get_session(name: nil) -> ::Google::Cloud::AIPlatform::V1::Session

Gets details of the specific Session.

Overloads
def get_session(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Session
Pass arguments to get_session via a request object, either of type GetSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::GetSessionRequest, ::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 get_session(name: nil) -> ::Google::Cloud::AIPlatform::V1::Session
Pass arguments to get_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).
Parameter
  • name (::String) — Required. The resource name of the session. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}
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/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::GetSessionRequest.new

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

# The returned object is of type Google::Cloud::AIPlatform::V1::Session.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Rest::Client

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

Returns
  • (Google::Iam::V1::IAMPolicy::Rest::Client)

#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::AIPlatform::V1::SessionService::Rest::Client.new

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

#list_events

def list_events(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::SessionEvent>
def list_events(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::SessionEvent>

Lists Events in a given session.

Overloads
def list_events(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::SessionEvent>
Pass arguments to list_events via a request object, either of type ListEventsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListEventsRequest, ::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 list_events(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::SessionEvent>
Pass arguments to list_events 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
  • parent (::String) — Required. The resource name of the session to list events from. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}
  • page_size (::Integer) — Optional. The maximum number of events to return. The service may return fewer than this value. If unspecified, at most 100 events will be returned. These events are ordered by timestamp in ascending order.
  • page_token (::String) — Optional. The next_page_token value returned from a previous list SessionService.ListEvents call.
  • filter (::String) — Optional. The standard list filter. Supported fields:

    • timestamp range (i.e. timestamp>="2025-01-31T11:30:00-04:00" where the timestamp is in RFC 3339 format)

    More detail in AIP-160.

  • order_by (::String) — Optional. A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields:

    • timestamp

    Example: timestamp desc.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ListEventsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::AIPlatform::V1::SessionEvent.
  p item
end

#list_sessions

def list_sessions(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Session>
def list_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Session>

Lists Sessions in a given reasoning engine.

Overloads
def list_sessions(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Session>
Pass arguments to list_sessions via a request object, either of type ListSessionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::ListSessionsRequest, ::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 list_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::AIPlatform::V1::Session>
Pass arguments to list_sessions 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
  • parent (::String) — Required. The resource name of the location to list sessions from. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}
  • page_size (::Integer) — Optional. The maximum number of sessions to return. The service may return fewer than this value. If unspecified, at most 100 sessions will be returned.
  • page_token (::String) — Optional. The next_page_token value returned from a previous list SessionService.ListSessions call.
  • filter (::String) — Optional. The standard list filter. Supported fields:

    • display_name
    • user_id
    • labels

    Example: display_name="abc", user_id="123", labels.key="value".

  • order_by (::String) — Optional. A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields:

    • create_time
    • update_time

    Example: create_time desc.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::ListSessionsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::AIPlatform::V1::Session.
  p item
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)

#operations_client

def operations_client() -> ::Google::Cloud::AIPlatform::V1::SessionService::Rest::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_session

def update_session(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Session
def update_session(session: nil, update_mask: nil) -> ::Google::Cloud::AIPlatform::V1::Session

Updates the specific Session.

Overloads
def update_session(request, options = nil) -> ::Google::Cloud::AIPlatform::V1::Session
Pass arguments to update_session via a request object, either of type UpdateSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AIPlatform::V1::UpdateSessionRequest, ::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 update_session(session: nil, update_mask: nil) -> ::Google::Cloud::AIPlatform::V1::Session
Pass arguments to update_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
  • session (::Google::Cloud::AIPlatform::V1::Session, ::Hash) — Required. The session to update. Format: projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. Field mask is used to control which fields get updated. If the mask is not present, all fields will be updated.
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/ai_platform/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AIPlatform::V1::UpdateSessionRequest.new

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

# The returned object is of type Google::Cloud::AIPlatform::V1::Session.
p result