pub struct TaskCompletion<'a> {
pub prompt: Prompt<'a>,
pub stopping: Stopping<'a>,
pub sampling: Sampling<'a>,
}
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.
stopping: Stopping<'a>
Controls in which circumstances the model will stop generating new tokens.
sampling: Sampling<'a>
Sampling controls how the tokens (“words”) are selected for the completion.
Implementations§
Source§impl<'a> TaskCompletion<'a>
impl<'a> TaskCompletion<'a>
Sourcepub fn from_text(text: &'a str) -> Self
pub fn from_text(text: &'a str) -> Self
Convenience constructor leaving most setting to default, just completing a given text
pub fn with_maximum_tokens(self, maximum_tokens: u32) -> Self
pub fn with_stop_sequences(self, stop_sequences: &'a [&str]) -> Self
Trait Implementations§
Source§impl StreamTask for TaskCompletion<'_>
impl StreamTask for TaskCompletion<'_>
Source§type Output = CompletionEvent
type Output = CompletionEvent
Output returned by
crate::Client::output_of
Source§type ResponseBody = CompletionEvent
type ResponseBody = CompletionEvent
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(response: Self::ResponseBody) -> Self::Output
fn body_to_output(response: Self::ResponseBody) -> Self::Output
Parses the response of the server into higher level structs for the user.
Source§fn with_model<'a>(&'a self, model: &'a str) -> MethodJob<'a, Self>where
Self: Sized,
fn with_model<'a>(&'a self, model: &'a str) -> MethodJob<'a, Self>where
Self: Sized,
Turn your task into [
Job
] by annotating it with a model name.Source§impl Task for TaskCompletion<'_>
impl Task for TaskCompletion<'_>
Source§type Output = CompletionOutput
type Output = CompletionOutput
Output returned by
crate::Client::output_of
Source§type ResponseBody = ResponseCompletion
type ResponseBody = ResponseCompletion
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 TaskCompletion<'a>
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§
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