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

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

A task send to the Aleph Alpha Api using the http client.

Required Associated Types§

source

type Output

Output returned by Client::execute

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, 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

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

Implementors§

source§

impl Task for TaskCompletion<'_>

§

type Output = CompletionOutput

§

type ResponseBody = ResponseCompletion

source§

impl Task for TaskSemanticEmbedding<'_>

§

type Output = SemanticEmbeddingOutput

§

type ResponseBody = SemanticEmbeddingOutput