Trait IntoPrompt

Source
pub trait IntoPrompt {
    type Message: Send + Sync + 'static;

    // 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§

Source

type Message: Send + Sync + 'static

Chat message representation emitted by the prompt.

Required Methods§

Source

fn into_prompt(self) -> Vec<Self::Message>

Consume self and return all messages in the desired order.

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.