#[non_exhaustive]pub struct Fact {
pub query: Option<String>,
pub title: Option<String>,
pub uri: Option<String>,
pub summary: Option<String>,
pub vector_distance: Option<f64>,
pub score: Option<f64>,
pub chunk: Option<RagChunk>,
/* private fields */
}vertex-rag-service only.Expand description
The fact used in grounding.
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.query: Option<String>Query that is used to retrieve this fact.
title: Option<String>If present, it refers to the title of this fact.
uri: Option<String>If present, this uri links to the source of the fact.
summary: Option<String>If present, the summary/snippet of the fact.
vector_distance: Option<f64>If present, the distance between the query vector and this fact vector.
score: Option<f64>If present, according to the underlying Vector DB and the selected metric type, the score can be either the distance or the similarity between the query and the fact and its range depends on the metric type.
For example, if the metric type is COSINE_DISTANCE, it represents the distance between the query and the fact. The larger the distance, the less relevant the fact is to the query. The range is [0, 2], while 0 means the most relevant and 2 means the least relevant.
chunk: Option<RagChunk>If present, chunk properties.
Implementations§
Source§impl Fact
impl Fact
pub fn new() -> Self
Sourcepub fn set_or_clear_query<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_query<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_title<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_title<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_uri<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_uri<T>(self, v: Option<T>) -> Self
Sourcepub fn set_summary<T>(self, v: T) -> Self
pub fn set_summary<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_summary<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_summary<T>(self, v: Option<T>) -> Self
Sourcepub fn set_vector_distance<T>(self, v: T) -> Self
👎Deprecated
pub fn set_vector_distance<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_vector_distance<T>(self, v: Option<T>) -> Self
👎Deprecated
pub fn set_or_clear_vector_distance<T>(self, v: Option<T>) -> Self
Sets or clears the value of vector_distance.
§Example
let x = Fact::new().set_or_clear_vector_distance(Some(42.0));
let x = Fact::new().set_or_clear_vector_distance(None::<f32>);