#[non_exhaustive]pub struct Context {
pub source_uri: String,
pub source_display_name: String,
pub text: String,
pub score: Option<f64>,
pub chunk: Option<RagChunk>,
/* private fields */
}vertex-rag-service only.Expand description
A context of the query.
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.source_uri: StringIf the file is imported from Cloud Storage or Google Drive, source_uri will be original file URI in Cloud Storage or Google Drive; if file is uploaded, source_uri will be file display name.
source_display_name: StringThe file display name.
text: StringThe text chunk.
score: Option<f64>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 context 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 context. The larger the distance, the less relevant the context is to the query. The range is [0, 2], while 0 means the most relevant and 2 means the least relevant.
chunk: Option<RagChunk>Context of the retrieved chunk.
Implementations§
Source§impl Context
impl Context
pub fn new() -> Self
Sourcepub fn set_source_uri<T: Into<String>>(self, v: T) -> Self
pub fn set_source_uri<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_source_display_name<T: Into<String>>(self, v: T) -> Self
pub fn set_source_display_name<T: Into<String>>(self, v: T) -> Self
Sets the value of source_display_name.
§Example
let x = Context::new().set_source_display_name("example");