Trait Job

Source
pub trait Job {
    type Output;
    type ResponseBody: for<'de> Deserialize<'de>;

    // Required methods
    fn build_request(&self, client: &Client, base: &str) -> RequestBuilder;
    fn body_to_output(&self, response: Self::ResponseBody) -> Self::Output;
}
Expand description

A job send to the Aleph Alpha Api using the http client. A job wraps all the knowledge required for the Aleph Alpha API to specify its result. Notably it includes the model(s) the job is executed on. This allows this trait to hold in the presence of services, which use more than one model and task type to achieve their result. On the other hand a bare crate::TaskCompletion can not implement this trait directly, since its result would depend on what model is chosen to execute it. You can remedy this by turning completion task into a job, calling Task::with_model.

Required Associated Types§

Source

type Output

Output returned by crate::Client::output_of

Source

type ResponseBody: for<'de> Deserialize<'de>

Expected answer of the Aleph Alpha API

Required Methods§

Source

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

Parses the response of the server into higher level structs for the user.

Implementors§

Source§

impl Job for TaskBatchSemanticEmbedding<'_>

Source§

type Output = BatchSemanticEmbeddingOutput

Source§

type ResponseBody = BatchSemanticEmbeddingOutput

Source§

impl Job for TaskSemanticEmbedding<'_>

Source§

type Output = SemanticEmbeddingOutput

Source§

type ResponseBody = SemanticEmbeddingOutput

Source§

impl Job for TaskSemanticEmbeddingWithInstruction<'_>

Source§

type Output = SemanticEmbeddingOutput

Source§

type ResponseBody = SemanticEmbeddingOutput