add base model to EmbeddingProvider, not yet leveraged for truncation

This commit is contained in:
KCaverly 2023-10-22 15:00:09 +02:00
parent d1dec8314a
commit 2b780ee7b2
5 changed files with 57 additions and 2 deletions

View file

@ -5,6 +5,8 @@ use rusqlite::types::{FromSql, FromSqlResult, ToSqlOutput, ValueRef};
use rusqlite::ToSql;
use std::time::Instant;
use crate::models::LanguageModel;
#[derive(Debug, PartialEq, Clone)]
pub struct Embedding(pub Vec<f32>);
@ -66,6 +68,7 @@ impl Embedding {
#[async_trait]
pub trait EmbeddingProvider: Sync + Send {
fn base_model(&self) -> Box<dyn LanguageModel>;
fn is_authenticated(&self) -> bool;
async fn embed_batch(&self, spans: Vec<String>) -> Result<Vec<Embedding>>;
fn max_tokens_per_batch(&self) -> usize;