pub struct FunctionPromptHandler { /* private fields */ }
Expand description
Function-based prompt handler
Implementations§
Source§impl FunctionPromptHandler
impl FunctionPromptHandler
Sourcepub fn new<F, Fut>(prompt: Prompt, handler: F) -> Selfwhere
F: Fn(GetPromptRequest, RequestContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ServerResult<GetPromptResult>> + Send + 'static,
pub fn new<F, Fut>(prompt: Prompt, handler: F) -> Selfwhere
F: Fn(GetPromptRequest, RequestContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ServerResult<GetPromptResult>> + Send + 'static,
Create a new function-based prompt handler
Trait Implementations§
Source§impl Debug for FunctionPromptHandler
impl Debug for FunctionPromptHandler
Source§impl PromptHandler for FunctionPromptHandler
impl PromptHandler for FunctionPromptHandler
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,
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
fn prompt_definition(&self) -> Prompt
Get the prompt definition
Source§fn validate_arguments(&self, _args: &HashMap<String, Value>) -> ServerResult<()>
fn validate_arguments(&self, _args: &HashMap<String, Value>) -> ServerResult<()>
Validate prompt arguments (optional, default implementation allows all)
Auto Trait Implementations§
impl Freeze for FunctionPromptHandler
impl !RefUnwindSafe for FunctionPromptHandler
impl Send for FunctionPromptHandler
impl Sync for FunctionPromptHandler
impl Unpin for FunctionPromptHandler
impl !UnwindSafe for FunctionPromptHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more