pub trait StreamingPrompt<M, R>where
M: CompletionModel + 'static,
<M as CompletionModel>::StreamingResponse: WasmCompatSend,
R: Clone + Unpin + GetTokenUsage,{
type Hook: PromptHook<M>;
// Required method
fn stream_prompt(
&self,
prompt: impl Into<Message> + WasmCompatSend,
) -> StreamingPromptRequest<M, Self::Hook>;
}Expand description
Trait for high-level streaming prompt interface.
This trait provides a simple interface for streaming prompts to a completion model. Implementations can optionally support prompt hooks for observing and controlling the agent’s execution lifecycle.
Required Associated Types§
Sourcetype Hook: PromptHook<M>
type Hook: PromptHook<M>
The hook type used by this streaming prompt implementation.
If your implementation does not need prompt hooks, use () as the hook type:
ⓘ
impl<M, R> StreamingPrompt<M, R> for MyType<M>
where
M: CompletionModel + 'static,
// ... other bounds ...
{
type Hook = ();
fn stream_prompt(&self, prompt: impl Into<Message>) -> StreamingPromptRequest<M, ()> {
// ...
}
}Required Methods§
Sourcefn stream_prompt(
&self,
prompt: impl Into<Message> + WasmCompatSend,
) -> StreamingPromptRequest<M, Self::Hook>
fn stream_prompt( &self, prompt: impl Into<Message> + WasmCompatSend, ) -> StreamingPromptRequest<M, Self::Hook>
Stream a simple prompt to the model
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".