Claim

#[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 */ }
Available on crate feature 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: String

Text 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

Source

pub fn new() -> Self

Source

pub fn set_start_pos<T>(self, v: T) -> Self
where T: Into<i32>,

Sets the value of start_pos.

§Example
let x = Claim::new().set_start_pos(42);
Source

pub fn set_or_clear_start_pos<T>(self, v: Option<T>) -> Self
where T: Into<i32>,

Sets or clears the value of start_pos.

§Example
let x = Claim::new().set_or_clear_start_pos(Some(42));
let x = Claim::new().set_or_clear_start_pos(None::<i32>);
Source

pub fn set_end_pos<T>(self, v: T) -> Self
where T: Into<i32>,

Sets the value of end_pos.

§Example
let x = Claim::new().set_end_pos(42);
Source

pub fn set_or_clear_end_pos<T>(self, v: Option<T>) -> Self
where T: Into<i32>,

Sets or clears the value of end_pos.

§Example
let x = Claim::new().set_or_clear_end_pos(Some(42));
let x = Claim::new().set_or_clear_end_pos(None::<i32>);
Source

pub fn set_claim_text<T: Into<String>>(self, v: T) -> Self

Sets the value of claim_text.

§Example
let x = Claim::new().set_claim_text("example");
Source

pub fn set_citation_indices<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<i32>,

Sets the value of citation_indices.

§Example
let x = Claim::new().set_citation_indices([1, 2, 3]);
Source

pub fn set_grounding_check_required<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of grounding_check_required.

§Example
let x = Claim::new().set_grounding_check_required(true);
Source

pub fn set_or_clear_grounding_check_required<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

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>);
Source

pub fn set_score<T>(self, v: T) -> Self
where T: Into<f64>,

Sets the value of score.

§Example
let x = Claim::new().set_score(42.0);
Source

pub fn set_or_clear_score<T>(self, v: Option<T>) -> Self
where T: Into<f64>,

Sets or clears the value of score.

§Example
let x = Claim::new().set_or_clear_score(Some(42.0));
let x = Claim::new().set_or_clear_score(None::<f32>);

Trait Implementations§

Source§

impl Clone for Claim

Source§

fn clone(&self) -> Claim

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Claim

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Claim

Source§

fn default() -> Claim

Returns the “default value” for a type. Read more
Source§

impl Message for Claim

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Claim

Source§

fn eq(&self, other: &Claim) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Claim

Auto Trait Implementations§

§

impl Freeze for Claim

§

impl RefUnwindSafe for Claim

§

impl Send for Claim

§

impl Sync for Claim

§

impl Unpin for Claim

§

impl UnwindSafe for Claim

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,