pub struct TaskSemanticEmbedding<'a> {
pub prompt: Prompt<'a>,
pub representation: SemanticRepresentation,
pub compress_to_size: Option<u32>,
}
Expand description
Create embeddings for prompts which can be used for downstream tasks. E.g. search, classifiers
Fields§
§prompt: Prompt<'a>
The prompt (usually text) to be embedded.
representation: SemanticRepresentation
Semantic representation to embed the prompt with. This parameter is governed by the specific use case in mind.
compress_to_size: Option<u32>
Default behaviour is to return the full embedding, but you can optionally request an
embedding compressed to a smaller set of dimensions. A size of 128
is supported for every
model.
The 128 size is expected to have a small drop in accuracy performance (4-6%), with the benefit of being much smaller, which makes comparing these embeddings much faster for use cases where speed is critical.
The 128 size can also perform better if you are embedding short texts or documents.
Trait Implementations§
Source§impl<'a> Debug for TaskSemanticEmbedding<'a>
impl<'a> Debug for TaskSemanticEmbedding<'a>
Source§impl Job for TaskSemanticEmbedding<'_>
impl Job for TaskSemanticEmbedding<'_>
Source§type Output = SemanticEmbeddingOutput
type Output = SemanticEmbeddingOutput
Output returned by
crate::Client::output_of
Source§type ResponseBody = SemanticEmbeddingOutput
type ResponseBody = SemanticEmbeddingOutput
Expected answer of the Aleph Alpha API
Source§fn build_request(&self, client: &Client, base: &str) -> RequestBuilder
fn build_request(&self, client: &Client, base: &str) -> RequestBuilder
Prepare the request for the Aleph Alpha API. Authentication headers can be assumed to be
already set.
Source§fn body_to_output(&self, response: Self::ResponseBody) -> Self::Output
fn body_to_output(&self, response: Self::ResponseBody) -> Self::Output
Parses the response of the server into higher level structs for the user.
Source§impl<'a> Serialize for TaskSemanticEmbedding<'a>
impl<'a> Serialize for TaskSemanticEmbedding<'a>
Source§impl Task for TaskSemanticEmbedding<'_>
impl Task for TaskSemanticEmbedding<'_>
Source§type Output = SemanticEmbeddingOutput
type Output = SemanticEmbeddingOutput
Output returned by
crate::Client::output_of
Source§type ResponseBody = SemanticEmbeddingOutput
type ResponseBody = SemanticEmbeddingOutput
Expected answer of the Aleph Alpha API
Source§fn build_request(
&self,
client: &Client,
base: &str,
model: &str,
) -> RequestBuilder
fn build_request( &self, client: &Client, base: &str, model: &str, ) -> RequestBuilder
Prepare the request for the Aleph Alpha API. Authentication headers can be assumed to be
already set.
Source§fn body_to_output(&self, response: Self::ResponseBody) -> Self::Output
fn body_to_output(&self, response: Self::ResponseBody) -> Self::Output
Parses the response of the server into higher level structs for the user.
Auto Trait Implementations§
impl<'a> Freeze for TaskSemanticEmbedding<'a>
impl<'a> RefUnwindSafe for TaskSemanticEmbedding<'a>
impl<'a> Send for TaskSemanticEmbedding<'a>
impl<'a> Sync for TaskSemanticEmbedding<'a>
impl<'a> Unpin for TaskSemanticEmbedding<'a>
impl<'a> UnwindSafe for TaskSemanticEmbedding<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more