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§
Required Associated Types§
Sourcetype Output: JsonSchema + for<'de> Deserialize<'de> + Any
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.