rig::embeddings

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§

Traits§

  • 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§

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