Reference documentation and code samples for the Data Analytics API with Gemini V1BETA API class Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.
REST client for the DataChatService service.
Service to ask a natural language question on top of BigQuery and Looker Studio datasources to get back streamed responses of various kinds to help provide a rich conversational answer.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the DataChatService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all DataChatService clients ::Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.configure do |config| config.timeout = 10.0 end
#chat
def chat(request, options = nil) -> ::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>
def chat(inline_context: nil, conversation_reference: nil, data_agent_context: nil, project: nil, parent: nil, messages: nil) -> ::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>
Answers a data question by generating a stream of [Message][google.cloud.geminidataanalytics.v1alpha.Message] objects.
def chat(request, options = nil) -> ::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>
chat
via a request object, either of type
ChatRequest or an equivalent Hash.
- request (::Google::Cloud::GeminiDataAnalytics::V1beta::ChatRequest, ::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 chat(inline_context: nil, conversation_reference: nil, data_agent_context: nil, project: nil, parent: nil, messages: nil) -> ::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>
chat
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).
-
inline_context (::Google::Cloud::GeminiDataAnalytics::V1beta::Context, ::Hash) — Optional. Inline context for the chat request. Use this to chat
statelessly (without managed conversation persistence and without an
Agent) by passing all context inline.
Note: The following parameters are mutually exclusive:
inline_context
,conversation_reference
,data_agent_context
. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. -
conversation_reference (::Google::Cloud::GeminiDataAnalytics::V1beta::ConversationReference, ::Hash) — Optional. Reference to a persisted conversation and agent context.
Use this to chat with an Agent using managed conversation persistence.
Note: The following parameters are mutually exclusive:
conversation_reference
,inline_context
,data_agent_context
. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. -
data_agent_context (::Google::Cloud::GeminiDataAnalytics::V1beta::DataAgentContext, ::Hash) — Optional. Context for the chat request. Use this to chat with an Agent
statelessly, without managed conversation persistence.
Note: The following parameters are mutually exclusive:
data_agent_context
,inline_context
,conversation_reference
. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one. - project (::String) — Optional. The Google Cloud project to be used for quota and billing.
-
parent (::String) — Required. The parent value for chat request.
Pattern:
projects/{project}/locations/{location}
- messages (::Array<::Google::Cloud::GeminiDataAnalytics::V1beta::Message, ::Hash>) — Required. Content of current conversation.
- (::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/gemini_data_analytics/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::GeminiDataAnalytics::V1beta::ChatRequest.new # Call the chat method to start streaming. output = client.chat request # The returned object is a streamed enumerable yielding elements of type # ::Google::Cloud::GeminiDataAnalytics::V1beta::Message output.each do |current_response| p current_response end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the DataChatService 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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_conversation
def create_conversation(request, options = nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
def create_conversation(parent: nil, conversation_id: nil, conversation: nil, request_id: nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
def create_conversation(request, options = nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
create_conversation
via a request object, either of type
CreateConversationRequest or an equivalent Hash.
- request (::Google::Cloud::GeminiDataAnalytics::V1beta::CreateConversationRequest, ::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_conversation(parent: nil, conversation_id: nil, conversation: nil, request_id: nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
create_conversation
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).
-
parent (::String) — Required. Parent value for CreateConversationRequest.
Format:
projects/{project}/locations/{location}
-
conversation_id (::String) — Optional. The conversation id of the conversation to create.
Must be unique within the parent.
The allowed format is:
^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$
. If not provided, the server will auto-generate a value for the id. - conversation (::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation, ::Hash) — Required. The conversation to create.
- request_id (::String) — Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/gemini_data_analytics/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::GeminiDataAnalytics::V1beta::CreateConversationRequest.new # Call the create_conversation method. result = client.create_conversation request # The returned object is of type Google::Cloud::GeminiDataAnalytics::V1beta::Conversation. p result
#get_conversation
def get_conversation(request, options = nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
def get_conversation(name: nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
Gets details of a single conversation by using conversation id and parent.
def get_conversation(request, options = nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
get_conversation
via a request object, either of type
GetConversationRequest or an equivalent Hash.
- request (::Google::Cloud::GeminiDataAnalytics::V1beta::GetConversationRequest, ::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_conversation(name: nil) -> ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
get_conversation
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).
-
name (::String) — Required. Name of the resource.
Format:
projects/{project}/locations/{location}/conversations/{conversation}
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/gemini_data_analytics/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::GeminiDataAnalytics::V1beta::GetConversationRequest.new # Call the get_conversation method. result = client.get_conversation request # The returned object is of type Google::Cloud::GeminiDataAnalytics::V1beta::Conversation. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new DataChatService REST client object.
- (config) — Configure the DataChatService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new do |config| config.timeout = 10.0 end
#list_conversations
def list_conversations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>
def list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>
Lists all conversations for a given parent.
def list_conversations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>
list_conversations
via a request object, either of type
ListConversationsRequest or an equivalent Hash.
- request (::Google::Cloud::GeminiDataAnalytics::V1beta::ListConversationsRequest, ::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_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>
list_conversations
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).
-
parent (::String) — Required. Parent value for ListConversationsRequest.
Format:
projects/{project}/locations/{location}
- page_size (::Integer) — Optional. Requested page size. Server may return fewer items than requested. The max page size is 100. All larger page sizes will be coerced to 100. If unspecified, server will pick 50 as an approperiate default.
- page_token (::String) — Optional. A token identifying a page of results the server should return.
-
filter (::String) —
Optional. Returned conversations will match criteria specified within the filter. ListConversations allows filtering by:
- agent_id
- labels
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/gemini_data_analytics/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::GeminiDataAnalytics::V1beta::ListConversationsRequest.new # Call the list_conversations method. result = client.list_conversations 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::GeminiDataAnalytics::V1beta::Conversation. p item end
#list_messages
def list_messages(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>
def list_messages(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>
Lists all messages for a given conversation.
def list_messages(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>
list_messages
via a request object, either of type
ListMessagesRequest or an equivalent Hash.
- request (::Google::Cloud::GeminiDataAnalytics::V1beta::ListMessagesRequest, ::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_messages(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>
list_messages
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).
-
parent (::String) — Required. The conversation to list messages under.
Format:
projects/{project}/locations/{location}/conversations/{conversation_id}
- page_size (::Integer) — Optional. Requested page size. Server may return fewer items than requested. The max page size is 100. All larger page sizes will be coerced to 100. If unspecified, server will pick 50 as an approperiate default.
- page_token (::String) — Optional. A token identifying a page of results the server should return.
-
filter (::String) —
Optional. Filtering results. See AIP-160 for syntax.
ListMessages allows filtering by:
- create_time (e.g.,
createTime > "2025-01-28T06:51:56-08:00"
) - update_time
- create_time (e.g.,
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/gemini_data_analytics/v1beta" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::GeminiDataAnalytics::V1beta::ListMessagesRequest.new # Call the list_messages method. result = client.list_messages 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::GeminiDataAnalytics::V1beta::StorageMessage. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Rest::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Rest::Client)
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)