/auto (#16696)
Add `/auto` behind a feature flag that's disabled for now, even for staff. We've decided on a different design for context inference, but there are parts of /auto that will be useful for that, so we want them in the code base even if they're unused for now. Release Notes: - N/A --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
93a3e8bc94
commit
91ffa02e2c
42 changed files with 2776 additions and 1054 deletions
|
@ -12,6 +12,12 @@ use futures::{future::BoxFuture, FutureExt};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt, future};
|
||||
|
||||
/// Trait for embedding providers. Texts in, vectors out.
|
||||
pub trait EmbeddingProvider: Sync + Send {
|
||||
fn embed<'a>(&'a self, texts: &'a [TextToEmbed<'a>]) -> BoxFuture<'a, Result<Vec<Embedding>>>;
|
||||
fn batch_size(&self) -> usize;
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Embedding(Vec<f32>);
|
||||
|
||||
|
@ -68,12 +74,6 @@ impl fmt::Display for Embedding {
|
|||
}
|
||||
}
|
||||
|
||||
/// Trait for embedding providers. Texts in, vectors out.
|
||||
pub trait EmbeddingProvider: Sync + Send {
|
||||
fn embed<'a>(&'a self, texts: &'a [TextToEmbed<'a>]) -> BoxFuture<'a, Result<Vec<Embedding>>>;
|
||||
fn batch_size(&self) -> usize;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TextToEmbed<'a> {
|
||||
pub text: &'a str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue