Skip to main content

RustPrompt

Trait RustPrompt 

Source
pub trait RustPrompt: Send + Sync {
    type Params: DeserializeOwned + JsonSchema + Send;

    const NAME: &'static str;
    const DESCRIPTION: &'static str;

    // Required method
    fn render(
        &self,
        params: Self::Params,
    ) -> impl Future<Output = Result<PromptOutput, ToolError>> + Send;

    // Provided method
    fn description(&self) -> Cow<'static, str> { ... }
}
Expand description

A custom prompt template implemented in Rust with strongly-typed parameters.

Required Associated Constants§

Source

const NAME: &'static str

Unique prompt name.

Source

const DESCRIPTION: &'static str

Human-readable description.

Required Associated Types§

Source

type Params: DeserializeOwned + JsonSchema + Send

The strongly-typed parameters struct deriving Deserialize + JsonSchema.

Required Methods§

Source

fn render( &self, params: Self::Params, ) -> impl Future<Output = Result<PromptOutput, ToolError>> + Send

Render the prompt template with typed parameters.

Provided Methods§

Source

fn description(&self) -> Cow<'static, str>

Return the prompt description.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§