# frozen_string_literal: true # Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! module Google module Cloud module DiscoveryEngine module V1 # Specification for the grounding check. # @!attribute [rw] citation_threshold # @return [::Float] # The threshold (in [0,1]) used for determining whether a fact must be # cited for a claim in the answer candidate. Choosing a higher threshold # will lead to fewer but very strong citations, while choosing a lower # threshold may lead to more but somewhat weaker citations. If unset, the # threshold will default to 0.6. class CheckGroundingSpec include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Request message for # {::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client#check_grounding GroundedGenerationService.CheckGrounding} # method. # @!attribute [rw] grounding_config # @return [::String] # Required. The resource name of the grounding config, such as # `projects/*/locations/global/groundingConfigs/default_grounding_config`. # @!attribute [rw] answer_candidate # @return [::String] # Answer candidate to check. Can have a maximum length of 1024 characters. # @!attribute [rw] facts # @return [::Array<::Google::Cloud::DiscoveryEngine::V1::GroundingFact>] # List of facts for the grounding check. # We support up to 200 facts. # @!attribute [rw] grounding_spec # @return [::Google::Cloud::DiscoveryEngine::V1::CheckGroundingSpec] # Configuration of the grounding check. # @!attribute [rw] user_labels # @return [::Google::Protobuf::Map{::String => ::String}] # The user labels applied to a resource must meet the following requirements: # # * Each resource can have multiple labels, up to a maximum of 64. # * Each label must be a key-value pair. # * Keys have a minimum length of 1 character and a maximum length of 63 # characters and cannot be empty. Values can be empty and have a maximum # length of 63 characters. # * Keys and values can contain only lowercase letters, numeric characters, # underscores, and dashes. All characters must use UTF-8 encoding, and # international characters are allowed. # * The key portion of a label must be unique. However, you can use the same # key with multiple resources. # * Keys must start with a lowercase letter or international character. # # See [Google Cloud # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) # for more details. class CheckGroundingRequest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # @!attribute [rw] key # @return [::String] # @!attribute [rw] value # @return [::String] class UserLabelsEntry include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end end # Response message for the # {::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client#check_grounding GroundedGenerationService.CheckGrounding} # method. # @!attribute [rw] support_score # @return [::Float] # The support score for the input answer candidate. # Higher the score, higher is the fraction of claims that are supported by # the provided facts. This is always set when a response is returned. # @!attribute [rw] cited_chunks # @return [::Array<::Google::Cloud::DiscoveryEngine::V1::FactChunk>] # List of facts cited across all claims in the answer candidate. # These are derived from the facts supplied in the request. # @!attribute [rw] claims # @return [::Array<::Google::Cloud::DiscoveryEngine::V1::CheckGroundingResponse::Claim>] # Claim texts and citation info across all claims in the answer candidate. class CheckGroundingResponse include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Text and citation info for a claim in the answer candidate. # @!attribute [rw] start_pos # @return [::Integer] # Position indicating the start of the claim in the answer candidate, # measured in bytes. # @!attribute [rw] end_pos # @return [::Integer] # Position indicating the end of the claim in the answer candidate, # exclusive. # @!attribute [rw] claim_text # @return [::String] # Text for the claim in the answer candidate. Always provided regardless of # whether citations or anti-citations are found. # @!attribute [rw] citation_indices # @return [::Array<::Integer>] # A list of indices (into 'cited_chunks') specifying the citations # associated with the claim. For instance [1,3,4] means that # cited_chunks[1], cited_chunks[3], cited_chunks[4] are the facts cited # supporting for the claim. A citation to a fact indicates that the claim # is supported by the fact. # @!attribute [rw] grounding_check_required # @return [::Boolean] # Indicates that this claim required grounding check. When the system # decided this claim doesn't require attribution/grounding check, this # field will be set to false. In that case, no grounding check was done for # the claim and therefore # {::Google::Cloud::DiscoveryEngine::V1::CheckGroundingResponse::Claim#citation_indices citation_indices}, # and # [anti_citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.anti_citation_indices] # should not be returned. class Claim include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end end end end end end