PromptHandler

Trait PromptHandler 

Source
pub trait PromptHandler: Send + Sync {
    // Required methods
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        request: GetPromptRequest,
        ctx: RequestContext,
    ) -> Pin<Box<dyn Future<Output = ServerResult<GetPromptResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn prompt_definition(&self) -> Prompt;

    // Provided method
    fn validate_arguments(
        &self,
        _args: &HashMap<String, Value>,
    ) -> ServerResult<()> { ... }
}
Expand description

Prompt handler trait for processing prompt requests

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, request: GetPromptRequest, ctx: RequestContext, ) -> Pin<Box<dyn Future<Output = ServerResult<GetPromptResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle a prompt request

Source

fn prompt_definition(&self) -> Prompt

Get the prompt definition

Provided Methods§

Source

fn validate_arguments(&self, _args: &HashMap<String, Value>) -> ServerResult<()>

Validate prompt arguments (optional, default implementation allows all)

Implementors§