#[non_exhaustive]pub struct Claim {
pub start_pos: Option<i32>,
pub end_pos: Option<i32>,
pub claim_text: String,
pub citation_indices: Vec<i32>,
pub grounding_check_required: Option<bool>,
pub score: Option<f64>,
/* private fields */
}grounded-generation-service only.Expand description
Text and citation info for a claim in the answer candidate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.start_pos: Option<i32>Position indicating the start of the claim in the answer candidate, measured in bytes. Note that this is not measured in characters and, therefore, must be rendered in the user interface keeping in mind that some characters may take more than one byte. For example, if the claim text contains non-ASCII characters, the start and end positions vary when measured in characters (programming-language-dependent) and when measured in bytes (programming-language-independent).
end_pos: Option<i32>Position indicating the end of the claim in the answer candidate, exclusive, in bytes. Note that this is not measured in characters and, therefore, must be rendered as such. For example, if the claim text contains non-ASCII characters, the start and end positions vary when measured in characters (programming-language-dependent) and when measured in bytes (programming-language-independent).
claim_text: StringText for the claim in the answer candidate. Always provided regardless of whether citations or anti-citations are found.
citation_indices: Vec<i32>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.
grounding_check_required: Option<bool>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 citation_indices should not be returned.
score: Option<f64>Confidence score for the claim in the answer candidate, in the range of
[0, 1]. This is set only when
CheckGroundingRequest.grounding_spec.enable_claim_level_score is true.
Implementations§
Source§impl Claim
impl Claim
pub fn new() -> Self
Sourcepub fn set_start_pos<T>(self, v: T) -> Self
pub fn set_start_pos<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_start_pos<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_start_pos<T>(self, v: Option<T>) -> Self
Sourcepub fn set_end_pos<T>(self, v: T) -> Self
pub fn set_end_pos<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_end_pos<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_end_pos<T>(self, v: Option<T>) -> Self
Sourcepub fn set_claim_text<T: Into<String>>(self, v: T) -> Self
pub fn set_claim_text<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_citation_indices<T, V>(self, v: T) -> Self
pub fn set_citation_indices<T, V>(self, v: T) -> Self
Sourcepub fn set_grounding_check_required<T>(self, v: T) -> Self
pub fn set_grounding_check_required<T>(self, v: T) -> Self
Sets the value of grounding_check_required.
§Example
let x = Claim::new().set_grounding_check_required(true);Sourcepub fn set_or_clear_grounding_check_required<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_grounding_check_required<T>(self, v: Option<T>) -> Self
Sets or clears the value of grounding_check_required.
§Example
let x = Claim::new().set_or_clear_grounding_check_required(Some(false));
let x = Claim::new().set_or_clear_grounding_check_required(None::<bool>);