#[non_exhaustive]pub struct FactChunk {
pub chunk_text: String,
pub source: String,
pub index: i32,
pub source_metadata: HashMap<String, String>,
pub uri: String,
pub title: String,
pub domain: String,
/* private fields */
}Available on crate feature
grounded-generation-service only.Expand description
Fact Chunk.
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.chunk_text: StringText content of the fact chunk. Can be at most 10K characters long.
source: StringSource from which this fact chunk was retrieved. If it was retrieved from the GroundingFacts provided in the request then this field will contain the index of the specific fact from which this chunk was retrieved.
index: i32The index of this chunk. Currently, only used for the streaming mode.
source_metadata: HashMap<String, String>More fine-grained information for the source reference.
uri: StringThe URI of the source.
title: StringThe title of the source.
domain: StringThe domain of the source.
Implementations§
Source§impl FactChunk
impl FactChunk
pub fn new() -> Self
Sourcepub fn set_chunk_text<T: Into<String>>(self, v: T) -> Self
pub fn set_chunk_text<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_source<T: Into<String>>(self, v: T) -> Self
pub fn set_source<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_source_metadata<T, K, V>(self, v: T) -> Self
pub fn set_source_metadata<T, K, V>(self, v: T) -> Self
Sets the value of source_metadata.
§Example
ⓘ
let x = FactChunk::new().set_source_metadata([
("key0", "abc"),
("key1", "xyz"),
]);Trait Implementations§
impl StructuralPartialEq for FactChunk
Auto Trait Implementations§
impl Freeze for FactChunk
impl RefUnwindSafe for FactChunk
impl Send for FactChunk
impl Sync for FactChunk
impl Unpin for FactChunk
impl UnwindSafe for FactChunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more