pub trait IntoPrompt {
type Message: Send + Sync;
// Required method
fn into_prompt(self) -> Vec<Self::Message>;
}Expand description
Converts a value into a series of chat messages.
Provider crates typically use crate::generic::GenericMessage, but a
back-end can require its own richer struct. By making the Message type
an associated type we keep the trait flexible without resorting to
dynamic dispatch.
Required Associated Types§
Required Methods§
Sourcefn into_prompt(self) -> Vec<Self::Message>
fn into_prompt(self) -> Vec<Self::Message>
Consume self and return all messages in the desired order.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IntoPrompt for CurrentDateFragment
impl IntoPrompt for CurrentDateFragment
type Message = GenericMessage
fn into_prompt(self) -> Vec<<CurrentDateFragment as IntoPrompt>::Message>
Source§impl IntoPrompt for StaticFragment<'_>
impl IntoPrompt for StaticFragment<'_>
type Message = GenericMessage
fn into_prompt(self) -> Vec<<StaticFragment<'_> as IntoPrompt>::Message>
Implementors§
Source§impl IntoPrompt for GenericMessage
Convenience implementation so a single crate::generic::GenericMessage
can be passed directly to the client without wrapping it in a struct.
impl IntoPrompt for GenericMessage
Convenience implementation so a single crate::generic::GenericMessage
can be passed directly to the client without wrapping it in a struct.