pub struct TaskChat<'a> {
pub messages: Vec<Message<'a>>,
pub stopping: Stopping<'a>,
pub sampling: ChatSampling,
pub logprobs: Logprobs,
}
Fields§
§messages: Vec<Message<'a>>
The list of messages comprising the conversation so far.
stopping: Stopping<'a>
Controls in which circumstances the model will stop generating new tokens.
sampling: ChatSampling
Sampling controls how the tokens (“words”) are selected for the completion.
logprobs: Logprobs
Use this to control the logarithmic probabilities you want to have returned. This is useful to figure out how likely it had been that this specific token had been sampled.
Implementations§
Source§impl<'a> TaskChat<'a>
impl<'a> TaskChat<'a>
Sourcepub fn with_message(message: Message<'a>) -> Self
pub fn with_message(message: Message<'a>) -> Self
Creates a new TaskChat containing one message with the given role and content. All optional TaskChat attributes are left unset.
Sourcepub fn with_messages(messages: Vec<Message<'a>>) -> Self
pub fn with_messages(messages: Vec<Message<'a>>) -> Self
Creates a new TaskChat containing the given messages. All optional TaskChat attributes are left unset.
Sourcepub fn push_message(self, message: Message<'a>) -> Self
pub fn push_message(self, message: Message<'a>) -> Self
Pushes a new Message to this TaskChat.
Sourcepub fn with_maximum_tokens(self, maximum_tokens: u32) -> Self
pub fn with_maximum_tokens(self, maximum_tokens: u32) -> Self
Sets the maximum token attribute of this TaskChat.
Sourcepub fn with_logprobs(self, logprobs: Logprobs) -> Self
pub fn with_logprobs(self, logprobs: Logprobs) -> Self
Sets the logprobs attribute of this TaskChat.
Trait Implementations§
Source§impl StreamTask for TaskChat<'_>
impl StreamTask for TaskChat<'_>
Source§type Output = ChatEvent
type Output = ChatEvent
Output returned by
crate::Client::output_of
Source§type ResponseBody = StreamChatResponse
type ResponseBody = StreamChatResponse
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) -> Option<Self::Output>
fn body_to_output(&self, response: Self::ResponseBody) -> Option<Self::Output>
Parses the response of the server into higher level structs for the user.
None
implies the output should be skipped.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 TaskChat<'_>
impl Task for TaskChat<'_>
Source§type Output = ChatOutput
type Output = ChatOutput
Output returned by
crate::Client::output_of
Source§type ResponseBody = ChatResponse
type ResponseBody = ChatResponse
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 TaskChat<'a>
impl<'a> RefUnwindSafe for TaskChat<'a>
impl<'a> Send for TaskChat<'a>
impl<'a> Sync for TaskChat<'a>
impl<'a> Unpin for TaskChat<'a>
impl<'a> UnwindSafe for TaskChat<'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