bf1c0d51e4
Co-authored-by: Wendy Tang <wendytang@squareup.com> Co-authored-by: Alice Hau <ahau@squareup.com>
25 lines
573 B
Rust
25 lines
573 B
Rust
use anyhow::Result;
|
|
use async_trait::async_trait;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct EmbeddingRequest {
|
|
pub input: Vec<String>,
|
|
pub model: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct EmbeddingResponse {
|
|
pub data: Vec<EmbeddingData>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct EmbeddingData {
|
|
pub embedding: Vec<f32>,
|
|
}
|
|
|
|
#[async_trait]
|
|
pub trait EmbeddingCapable {
|
|
async fn create_embeddings(&self, texts: Vec<String>) -> Result<Vec<Vec<f32>>>;
|
|
}
|