Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"proto_docs/google/protobuf/field_mask.rb",
"proto_docs/google/protobuf/struct.rb",
"proto_docs/google/protobuf/timestamp.rb",
"proto_docs/google/protobuf/wrappers.rb",
"proto_docs/google/rpc/status.rb",
"proto_docs/google/type/expr.rb",
"snippets/Gemfile",
Expand All @@ -81,6 +82,7 @@
"snippets/data_agent_service/update_data_agent.rb",
"snippets/data_chat_service/chat.rb",
"snippets/data_chat_service/create_conversation.rb",
"snippets/data_chat_service/delete_conversation.rb",
"snippets/data_chat_service/get_conversation.rb",
"snippets/data_chat_service/list_conversations.rb",
"snippets/data_chat_service/list_messages.rb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
"create_conversation"
]
},
"DeleteConversation": {
"methods": [
"delete_conversation"
]
},
"GetConversation": {
"methods": [
"get_conversation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def self.configure
end
default_config = Client::Configuration.new parent_config

default_config.timeout = 60.0
default_config.timeout = 600.0
default_config.retry_policy = {
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def self.configure
end
default_config = Client::Configuration.new parent_config

default_config.timeout = 60.0
default_config.timeout = 600.0
default_config.retry_policy = {
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def self.configure
end
default_config = Client::Configuration.new parent_config

default_config.timeout = 60.0
default_config.timeout = 600.0
default_config.retry_policy = {
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
}
Expand Down Expand Up @@ -220,7 +220,7 @@ def logger
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload chat(inline_context: nil, conversation_reference: nil, data_agent_context: nil, project: nil, parent: nil, messages: nil)
# @overload chat(inline_context: nil, conversation_reference: nil, data_agent_context: nil, client_managed_resource_context: nil, project: nil, parent: nil, messages: nil)
# Pass arguments to `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).
Expand All @@ -230,17 +230,24 @@ def logger
# 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.
# Note: The following parameters are mutually exclusive: `inline_context`, `conversation_reference`, `data_agent_context`, `client_managed_resource_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.
# @param 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.
# Note: The following parameters are mutually exclusive: `conversation_reference`, `inline_context`, `data_agent_context`, `client_managed_resource_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.
# @param 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.
# Note: The following parameters are mutually exclusive: `data_agent_context`, `inline_context`, `conversation_reference`, `client_managed_resource_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.
# @param client_managed_resource_context [::Google::Cloud::GeminiDataAnalytics::V1beta::ClientManagedResourceContext, ::Hash]
# Optional. Context with client managed resources.
# Some clients may not use GDA managed resources including
# conversations and agents, instead they create and manage their own
# conversations and agents resources.
#
# Note: The following parameters are mutually exclusive: `client_managed_resource_context`, `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.
# @param project [::String]
# Optional. The Google Cloud project to be used for quota and billing.
# @param parent [::String]
Expand Down Expand Up @@ -415,6 +422,93 @@ def create_conversation request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Deletes a conversation.
#
# @overload delete_conversation(request, options = nil)
# Pass arguments to `delete_conversation` via a request object, either of type
# {::Google::Cloud::GeminiDataAnalytics::V1beta::DeleteConversationRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::GeminiDataAnalytics::V1beta::DeleteConversationRequest, ::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.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload delete_conversation(name: nil)
# Pass arguments to `delete_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).
#
# @param name [::String]
# Required. Name of the resource.
# Format:
# `projects/{project}/locations/{location}/conversations/{conversation}`
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Protobuf::Empty]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Google::Protobuf::Empty]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
# @example 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::DeleteConversationRequest.new
#
# # Call the delete_conversation method.
# result = client.delete_conversation request
#
# # The returned object is of type Google::Protobuf::Empty.
# p result
#
def delete_conversation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GeminiDataAnalytics::V1beta::DeleteConversationRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
metadata = @config.rpcs.delete_conversation.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::GeminiDataAnalytics::V1beta::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

header_params = {}
if request.name
header_params["name"] = request.name
end

request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header

options.apply_defaults timeout: @config.rpcs.delete_conversation.timeout,
metadata: metadata,
retry_policy: @config.rpcs.delete_conversation.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@data_chat_service_stub.call_rpc :delete_conversation, request, options: options do |response, operation|
yield response, operation if block_given?
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Gets details of a single conversation by using conversation id and parent.
#
Expand Down Expand Up @@ -532,7 +626,7 @@ def get_conversation request, options = nil
# @param filter [::String]
# Optional. Returned conversations will match criteria specified within the
# filter. ListConversations allows filtering by:
# * agent_id
# * agents
# * labels
#
# @yield [response, operation] Access the result along with the RPC operation
Expand Down Expand Up @@ -905,6 +999,11 @@ class Rpcs
#
attr_reader :create_conversation
##
# RPC-specific configuration for `delete_conversation`
# @return [::Gapic::Config::Method]
#
attr_reader :delete_conversation
##
# RPC-specific configuration for `get_conversation`
# @return [::Gapic::Config::Method]
#
Expand All @@ -926,6 +1025,8 @@ def initialize parent_rpcs = nil
@chat = ::Gapic::Config::Method.new chat_config
create_conversation_config = parent_rpcs.create_conversation if parent_rpcs.respond_to? :create_conversation
@create_conversation = ::Gapic::Config::Method.new create_conversation_config
delete_conversation_config = parent_rpcs.delete_conversation if parent_rpcs.respond_to? :delete_conversation
@delete_conversation = ::Gapic::Config::Method.new delete_conversation_config
get_conversation_config = parent_rpcs.get_conversation if parent_rpcs.respond_to? :get_conversation
@get_conversation = ::Gapic::Config::Method.new get_conversation_config
list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
Expand Down
Loading