Skip to main content

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl PromptHandler for TaskWorkflowPromptHandler

Available on non-WebAssembly only.
Source§

impl PromptHandler for WorkflowPromptHandler

Available on non-WebAssembly only.
Source§

impl<F> PromptHandler for SimplePrompt<F>

Available on non-WebAssembly only.
Source§

impl<F> PromptHandler for SyncPrompt<F>

Available on non-WebAssembly only.
Source§

impl<T, F> PromptHandler for TypedPrompt<T, F>
where T: DeserializeOwned + Send + Sync + 'static, F: Fn(T, RequestHandlerExtra) -> Pin<Box<dyn Future<Output = Result<GetPromptResult>> + Send>> + Send + Sync,

Available on non-WebAssembly only.