PromptHandler

Trait PromptHandler 

Source
pub trait PromptHandler: Send + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        args: HashMap<String, String>,
        extra: RequestHandlerExtra,
    ) -> Pin<Box<dyn Future<Output = Result<GetPromptResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn metadata(&self) -> Option<PromptInfo> { ... }
}
Expand description

Handler for prompt generation.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, args: HashMap<String, String>, extra: RequestHandlerExtra, ) -> Pin<Box<dyn Future<Output = Result<GetPromptResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate a prompt with the given arguments.

Provided Methods§

Source

fn metadata(&self) -> Option<PromptInfo>

Get prompt metadata including description and arguments schema. Returns None to use default empty metadata.

Implementors§

Source§

impl<F> PromptHandler for SimplePrompt<F>

Available on non-WebAssembly only.
Source§

impl<F> PromptHandler for SyncPrompt<F>

Available on non-WebAssembly only.