pub struct StatusMessageGenerator { /* private fields */ }Expand description
Generator for dynamic status messages
Implementations§
Source§impl StatusMessageGenerator
impl StatusMessageGenerator
Sourcepub fn new(provider: impl Into<String>, fast_model: impl Into<String>) -> Self
pub fn new(provider: impl Into<String>, fast_model: impl Into<String>) -> Self
Create a new status message generator
§Arguments
provider- LLM provider name (e.g., “anthropic”, “openai”)fast_model- Model to use for quick generationstimeout_ms- Hard timeout in milliseconds (default: 500)
Sourcepub fn with_timeout_ms(self, ms: u64) -> Self
pub fn with_timeout_ms(self, ms: u64) -> Self
Set custom timeout in milliseconds
Sourcepub async fn generate(&self, context: &StatusContext) -> StatusMessage
pub async fn generate(&self, context: &StatusContext) -> StatusMessage
Generate a status message synchronously with timeout
Returns default message if generation fails or times out.
Sourcepub fn spawn_generation(
&self,
context: StatusContext,
tx: UnboundedSender<StatusMessage>,
)
pub fn spawn_generation( &self, context: StatusContext, tx: UnboundedSender<StatusMessage>, )
Spawn fire-and-forget generation that sends result to channel
This spawns an async task that will send the generated message to the provided channel. If generation times out or fails, nothing is sent (caller should already have a fallback displayed).
Sourcepub fn create_channel() -> (UnboundedSender<StatusMessage>, UnboundedReceiver<StatusMessage>)
pub fn create_channel() -> (UnboundedSender<StatusMessage>, UnboundedReceiver<StatusMessage>)
Create a channel for receiving status messages
Sourcepub async fn generate_completion(
&self,
context: &StatusContext,
) -> StatusMessage
pub async fn generate_completion( &self, context: &StatusContext, ) -> StatusMessage
Generate a completion message when a task finishes
Auto Trait Implementations§
impl Freeze for StatusMessageGenerator
impl RefUnwindSafe for StatusMessageGenerator
impl Send for StatusMessageGenerator
impl Sync for StatusMessageGenerator
impl Unpin for StatusMessageGenerator
impl UnwindSafe for StatusMessageGenerator
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> 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