pub struct Chunk { /* private fields */ }
Expand description
Implementations§
Source§impl Chunk
impl Chunk
Sourcepub fn new(chunk: impl Into<Arc<str>>) -> Self
pub fn new(chunk: impl Into<Arc<str>>) -> Self
§Chunk::new
This is the constructor to use when we have some text with no metadata that we wish to include with it.
§Arguments
- content:
Into<Arc<str>>
- this is the text content of the chunk
§Returns
Chunk
- a new Chunk with no metadata
Sourcepub fn new_with_metadata(content: impl Into<Arc<str>>, metadata: Value) -> Self
pub fn new_with_metadata(content: impl Into<Arc<str>>, metadata: Value) -> Self
§Chunk::new_with_metadata
This is the constructor to use when we have some text with metadata. Note the metadata does not influence any generated embeddings. It can just be kept with the text and embedding in whatever vector store you choose to use.
§Arguments
- content:
Into<Arc<str>>
- pointer to the chunk str - metadata:
serde_json::Value
- metadata associated with the chunk
§Returns
Chunk
- a new Chunk
Sourcepub fn metadata(&self) -> &Value
pub fn metadata(&self) -> &Value
§Chunk::metadata
Getter for the metadata
§Returns
- &
serde_json::Value
- reference to metadata associated with the chunk
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chunk
impl<'de> Deserialize<'de> for Chunk
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Chunk
impl StructuralPartialEq for Chunk
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnwindSafe for Chunk
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more