gleamstral/embeddings/embeddings
Types
pub type Config {
Config(encoding_format: EncodingFormat)
}
Constructors
-
Config(encoding_format: EncodingFormat)
Represents an embeddings service with configuration options
Use this to generate vector embeddings for text inputs
pub type Embeddings {
Embeddings(client: client.Client, config: Config)
}
Constructors
-
Embeddings(client: client.Client, config: Config)
Format of the generated embeddings
Float
: Standard floating point format for vector embeddings
pub type EncodingFormat {
Float
}
Constructors
-
Float
Functions
pub fn create(
embeddings: Embeddings,
model: Model,
inputs: List(String),
) -> Result(Response, Error)
Generates embeddings for the provided text inputs
Parameters
embeddings
: The configured Embeddings instancemodel
: The model to use for generating embeddingsinputs
: A list of text strings to generate embeddings for
Returns
Ok(response.Response)
: The successful response containing embeddingsError(client.Error)
: An error that occurred during the request
Example
let result = embeddings.create(
embeddings,
model.EmbeddingMistral,
["Text to embed", "Another text to embed"]
)
pub fn new(client: Client) -> Embeddings
Creates a new Embeddings instance with default configuration using the provided client
Example
let client = client.new("your-api-key")
let embeddings = embeddings.new(client)
pub fn set_encoding_format(
embeddings: Embeddings,
encoding_format: EncodingFormat,
) -> Embeddings