67de49abbb
Signed-off-by: Adrian Cole <adrian@tetrate.io>
29 lines
622 B
Rust
29 lines
622 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,
|
|
session_id: &str,
|
|
texts: Vec<String>,
|
|
) -> Result<Vec<Vec<f32>>>;
|
|
}
|