1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use serde::{Deserialize, Serialize};

use super::{EmbedModel, Truncate};

#[derive(Serialize, Debug)]
pub struct EmbedRequest<'input> {
    /// An optional string representing the model you'd like to use.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub model: Option<EmbedModel>,
    /// An array of strings for the model to embed.
    pub texts: &'input [String],
    /// Specify how the API will handle inputs longer than the maximum token length.
    pub truncate: Truncate,
}

#[derive(Deserialize, Debug)]
pub(crate) struct EmbedResponse {
    /// An array of embeddings, where each embedding is an array of floats. The length of the embeddings
    /// array will be the same as the length of the original texts array.
    pub embeddings: Vec<Vec<f64>>,
}