alith_client/
embeddings.rs

1use alith_interface::{
2    llms::LLMBackend,
3    requests::embeddings::{EmbeddingsRequest, EmbeddingsResponse},
4};
5use std::sync::Arc;
6
7#[derive(Clone)]
8pub struct Embeddings {
9    pub req: EmbeddingsRequest,
10}
11
12impl Embeddings {
13    pub fn new(backend: Arc<LLMBackend>) -> Self {
14        Self {
15            req: EmbeddingsRequest::new(backend),
16        }
17    }
18
19    pub async fn run(&mut self) -> crate::Result<EmbeddingsResponse> {
20        let res = self.req.request().await?;
21
22        Ok(res)
23    }
24
25    #[inline]
26    pub fn set_input(&mut self, input: Vec<String>) {
27        self.req.input = input;
28    }
29
30    #[inline]
31    pub fn set_model(&mut self, model: String) {
32        self.req.model = model;
33    }
34}