Skip to main content

OAIPromptFormatter

Trait OAIPromptFormatter 

Source
pub trait OAIPromptFormatter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn supports_add_generation_prompt(&self) -> bool;
    fn render(&self, req: &dyn OAIChatLikeRequest) -> Result<String>;

    // Provided methods
    fn media_message_order(
        &self,
        _request: &dyn OAIChatLikeRequest,
    ) -> Option<Vec<usize>> { ... }
    fn render_prompt(
        &self,
        req: &dyn OAIChatLikeRequest,
    ) -> Result<RenderedPrompt> { ... }
}

Required Methods§

Provided Methods§

Source

fn media_message_order( &self, _request: &dyn OAIChatLikeRequest, ) -> Option<Vec<usize>>

Source message indices in rendered media order; None preserves arrival order. An explicit order must be a permutation of all source-message indices. Parts within each message retain their original order.

Source

fn render_prompt(&self, req: &dyn OAIChatLikeRequest) -> Result<RenderedPrompt>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§