added proper blob serialization for embeddings and vector search trait

This commit is contained in:
KCaverly 2023-06-25 20:02:56 -04:00
parent c071b271be
commit 65bbb7c57b
6 changed files with 104 additions and 39 deletions

View file

@ -13,6 +13,7 @@ lazy_static! {
static ref OPENAI_API_KEY: Option<String> = env::var("OPENAI_API_KEY").ok();
}
#[derive(Clone)]
pub struct OpenAIEmbeddings {
pub client: Arc<dyn HttpClient>,
}
@ -54,7 +55,7 @@ impl EmbeddingProvider for DummyEmbeddings {
async fn embed_batch(&self, spans: Vec<&str>) -> Result<Vec<Vec<f32>>> {
// 1024 is the OpenAI Embeddings size for ada models.
// the model we will likely be starting with.
let dummy_vec = vec![0.32 as f32; 1024];
let dummy_vec = vec![0.32 as f32; 1536];
return Ok(vec![dummy_vec; spans.len()]);
}
}