Struct aleph_alpha_client::TaskCompletion
source · [−]pub struct TaskCompletion<'a> {
pub prompt: Prompt<'a>,
pub maximum_tokens: u32,
pub sampling: Sampling,
}
Expand description
Completes a prompt. E.g. continues a text.
Fields
prompt: Prompt<'a>
The prompt (usually text) to be completed. Unconditional completion can be started with an empty string. The prompt may contain a zero shot or few shot task.
maximum_tokens: u32
The maximum number of tokens to be generated. Completion will terminate after the maximum number of tokens is reachedIncrease this value to allow for longer outputs. A text is split into tokens. Usually there are more tokens than words. The total number of tokens of prompt and maximum_tokens depends on the model.
sampling: Sampling
Sampling controls how the tokens (“words”) are selected for the completion.
Trait Implementations
sourceimpl Task for TaskCompletion<'_>
impl Task for TaskCompletion<'_>
type Output = CompletionOutput
type Output = CompletionOutput
Output returned by Client::execute
type ResponseBody = ResponseCompletion
type ResponseBody = ResponseCompletion
Expected answer of the Aleph Alpha API
sourcefn 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. Read more
sourcefn 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> RefUnwindSafe for TaskCompletion<'a>
impl<'a> Send for TaskCompletion<'a>
impl<'a> Sync for TaskCompletion<'a>
impl<'a> Unpin for TaskCompletion<'a>
impl<'a> UnwindSafe for TaskCompletion<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more