Skip to main content

IntoPrompt

Trait IntoPrompt 

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

Source

type Message: Send + Sync

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.

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

Source§

impl IntoPrompt for StaticFragment<'_>

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.