pub struct TogetherEmbedProvider { /* private fields */ }Expand description
Embedding provider backed by the Together AI embeddings API.
Default model: togethercomputer/m2-bert-80M-32k-retrieval (768 dims).
Together uses an OpenAI-compatible request/response shape.
Implementations§
Source§impl TogetherEmbedProvider
impl TogetherEmbedProvider
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Create a new Together provider with the default BERT retrieval model.
Sourcepub fn with_model(
api_key: impl Into<String>,
model: impl Into<String>,
dimensions: usize,
) -> Self
pub fn with_model( api_key: impl Into<String>, model: impl Into<String>, dimensions: usize, ) -> Self
Create with an explicit model and dimension override.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the API base URL.
Sourcepub fn build_payload(&self, texts: &[String]) -> Value
pub fn build_payload(&self, texts: &[String]) -> Value
Build the request payload for the Together API.
Trait Implementations§
Source§impl EmbeddingProvider for TogetherEmbedProvider
impl EmbeddingProvider for TogetherEmbedProvider
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Compute embedding vector for a single text.
Source§fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = ArgentorResult<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Compute embeddings for a batch of texts.
Auto Trait Implementations§
impl Freeze for TogetherEmbedProvider
impl RefUnwindSafe for TogetherEmbedProvider
impl Send for TogetherEmbedProvider
impl Sync for TogetherEmbedProvider
impl Unpin for TogetherEmbedProvider
impl UnsafeUnpin for TogetherEmbedProvider
impl UnwindSafe for TogetherEmbedProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more