cohere_rust/api/
embed.rs

1use serde::{Deserialize, Serialize};
2
3use super::{EmbedModel, Truncate};
4
5#[derive(Serialize, Debug)]
6pub struct EmbedRequest<'input> {
7    /// An optional string representing the model you'd like to use.
8    #[serde(skip_serializing_if = "Option::is_none")]
9    pub model: Option<EmbedModel>,
10    /// An array of strings for the model to embed.
11    pub texts: &'input [String],
12    /// Specify how the API will handle inputs longer than the maximum token length.
13    pub truncate: Truncate,
14}
15
16#[derive(Deserialize, Debug)]
17pub(crate) struct EmbedResponse {
18    /// An array of embeddings, where each embedding is an array of floats. The length of the embeddings
19    /// array will be the same as the length of the original texts array.
20    pub embeddings: Vec<Vec<f64>>,
21}