Module embed

Module embed 

Source
Expand description

The module defines the Embed trait, which must be implemented for types that can be embedded by the crate::embeddings::EmbeddingsBuilder.

The module also defines the EmbedError struct which is used for when the Embed::embed method of the Embed trait fails.

The module also defines the TextEmbedder struct which accumulates string values that need to be embedded. It is used directly with the Embed trait.

Finally, the module implements Embed for many common primitive types.

Structs§

EmbedError
Error type used for when the Embed::embed method of the Embed trait fails. Used by default implementations of Embed for common types.
TextEmbedder
Accumulates string values that need to be embedded. Used by the Embed trait.

Traits§

Embed
Derive this trait for objects that need to be converted to vector embeddings. The Embed::embed method accumulates string values that need to be embedded by adding them to the TextEmbedder. If an error occurs, the method should return EmbedError.

Functions§

to_texts
Utility function that returns a vector of strings that need to be embedded for a given object that implements the Embed trait.