Data Analytics API with Gemini V1BETA API - Class Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Client (v0.3.1)
Stay organized with collections
Save and categorize content based on your preferences.
Reference documentation and code samples for the Data Analytics API with Gemini V1BETA API class Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Client.
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
defself.configure(){|config|...}->Client::ConfigurationConfigure 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::Client.configuredo|config| config.timeout=10.0 end
#chat
defchat(request,options=nil)->::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>
defchat(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.
defchat(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.
defchat(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.
- (response, operation) — Access the result along with the RPC operation
- response (::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>)
- operation (::GRPC::ActiveCall::Operation)
- (::Enumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Message>)
- (::Google::Cloud::Error) — if the RPC 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::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.chatrequest # The returned object is a streamed enumerable yielding elements of type # ::Google::Cloud::GeminiDataAnalytics::V1beta::Message output.eachdo|current_response| pcurrent_response end
#configure
defconfigure(){|config|...}->Client::ConfigurationConfigure 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
defcreate_conversation(request,options=nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
defcreate_conversation(parent:nil,conversation_id:nil,conversation:nil,request_id:nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::ConversationCreates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
defcreate_conversation(request,options=nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::Conversationcreate_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.
defcreate_conversation(parent:nil,conversation_id:nil,conversation:nil,request_id:nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::Conversationcreate_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.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::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_conversationrequest # The returned object is of type Google::Cloud::GeminiDataAnalytics::V1beta::Conversation. presult
#get_conversation
defget_conversation(request,options=nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation
defget_conversation(name:nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::ConversationGets details of a single conversation by using conversation id and parent.
defget_conversation(request,options=nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::Conversationget_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.
defget_conversation(name:nil)->::Google::Cloud::GeminiDataAnalytics::V1beta::Conversationget_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}
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::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_conversationrequest # The returned object is of type Google::Cloud::GeminiDataAnalytics::V1beta::Conversation. presult
#initialize
definitialize(){|config|...}->ClientCreate a new DataChatService 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::Client.new # Create a client using a custom configuration client=::Google::Cloud::GeminiDataAnalytics::V1beta::DataChatService::Client.newdo|config| config.timeout=10.0 end
#list_conversations
deflist_conversations(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>
deflist_conversations(parent:nil,page_size:nil,page_token:nil,filter:nil)->::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>Lists all conversations for a given parent.
deflist_conversations(request,options=nil)->::Gapic::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.
deflist_conversations(parent:nil,page_size:nil,page_token:nil,filter:nil)->::Gapic::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
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation>)
- (::Google::Cloud::Error) — if the RPC 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::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_conversationsrequest # 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.eachdo|item| # Each element is of type ::Google::Cloud::GeminiDataAnalytics::V1beta::Conversation. pitem end
#list_messages
deflist_messages(request,options=nil)->::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>
deflist_messages(parent:nil,page_size:nil,page_token:nil,filter:nil)->::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>Lists all messages for a given conversation.
deflist_messages(request,options=nil)->::Gapic::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.
deflist_messages(parent:nil,page_size:nil,page_token:nil,filter:nil)->::Gapic::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月28日T06:51:56-08:00") - update_time
- create_time (e.g.,
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage>)
- (::Google::Cloud::Error) — if the RPC 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::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_messagesrequest # 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.eachdo|item| # Each element is of type ::Google::Cloud::GeminiDataAnalytics::V1beta::StorageMessage. pitem end
#location_client
deflocation_client()->Google::Cloud::Location::Locations::ClientGet the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#logger
deflogger()->LoggerThe logger used for request/response debug logging.
- (Logger)
#universe_domain
defuniverse_domain()->StringThe effective universe domain
- (String)