Trait PromptTemplate

Source
pub trait PromptTemplate: IntoPrompt {
    type Output: JsonSchema + for<'de> Deserialize<'de> + Any;

    const MODEL: Model;
}
Expand description

High-level description of a prompt.

Implement this trait in addition to IntoPrompt to specify:

  • Output – the strongly-typed Rust struct you expect from the LLM.
  • MODEL – the identifier of the model that should handle the request.

The blanket constraints on Output (JsonSchema + Deserialize + Any) enable the OpenAI adapter to automatically derive a JSON Schema and to down-cast the erased type if necessary.

Required Associated Constants§

Source

const MODEL: Model

Logical model identifier. The back-end will map this to its own naming scheme ("gpt-4o-mini", "claude-3-haiku", …).

Required Associated Types§

Source

type Output: JsonSchema + for<'de> Deserialize<'de> + Any

Type produced by the LLM and returned to the caller.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§