Struct kalosm_language_model::StreamTextBuilder
source · pub struct StreamTextBuilder<'a, M: Model> { /* private fields */ }
Expand description
A builder for the ModelExt::stream_text
method.
Implementations§
source§impl<'a, M: Model> StreamTextBuilder<'a, M>
impl<'a, M: Model> StreamTextBuilder<'a, M>
sourcepub fn new(
prompt: &'a str,
self_: &'a M,
future: fn(_: &'a M, _: &'a str, _: GenerationParameters) -> Pin<Box<dyn Future<Output = Result<M::TextStream>> + Send + 'a>>
) -> Self
pub fn new( prompt: &'a str, self_: &'a M, future: fn(_: &'a M, _: &'a str, _: GenerationParameters) -> Pin<Box<dyn Future<Output = Result<M::TextStream>> + Send + 'a>> ) -> Self
Create a new builder to return from the ModelExt::stream_text
method.
sourcepub fn with_generation_parameters(
self,
parameters: GenerationParameters
) -> Self
pub fn with_generation_parameters( self, parameters: GenerationParameters ) -> Self
Set the generation parameters to use when generating text. This will override any parameters set by other methods.
sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature to use when generating text.
sourcepub fn with_repetition_penalty(self, repetition_penalty: f32) -> Self
pub fn with_repetition_penalty(self, repetition_penalty: f32) -> Self
Set the repetition penalty to use when generating text.
sourcepub fn with_repetition_penalty_range(
self,
repetition_penalty_range: u32
) -> Self
pub fn with_repetition_penalty_range( self, repetition_penalty_range: u32 ) -> Self
Set the repetition penalty range to use when generating text.
sourcepub fn with_max_length(self, max_length: u32) -> Self
pub fn with_max_length(self, max_length: u32) -> Self
Set the maximum length to use when generating text.
sourcepub fn with_stop_on(self, stop_on: impl Into<Option<String>>) -> Self
pub fn with_stop_on(self, stop_on: impl Into<Option<String>>) -> Self
Set the string to stop on when generating text.
Trait Implementations§
source§impl<'a, M: Model> IntoFuture for StreamTextBuilder<'a, M>
impl<'a, M: Model> IntoFuture for StreamTextBuilder<'a, M>
§type Output = Result<<M as Model>::TextStream, Error>
type Output = Result<<M as Model>::TextStream, Error>
The output that the future will produce on completion.
§type IntoFuture = Pin<Box<dyn Future<Output = <StreamTextBuilder<'a, M> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <StreamTextBuilder<'a, M> as IntoFuture>::Output> + Send + 'a>>
Which kind of future are we turning this into?
source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<'a, M> RefUnwindSafe for StreamTextBuilder<'a, M>where
M: RefUnwindSafe,
impl<'a, M> Send for StreamTextBuilder<'a, M>
impl<'a, M> Sync for StreamTextBuilder<'a, M>
impl<'a, M> Unpin for StreamTextBuilder<'a, M>
impl<'a, M> UnwindSafe for StreamTextBuilder<'a, M>where
M: RefUnwindSafe,
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