Skip to main content

TypedPrompt

Trait TypedPrompt 

Source
pub trait TypedPrompt: WasmCompatSend + WasmCompatSync {
    type TypedRequest<T>: IntoFuture<Output = Result<T, StructuredOutputError>>
       where T: JsonSchema + DeserializeOwned + WasmCompatSend + 'static;

    // Required method
    fn prompt_typed<T>(
        &self,
        prompt: impl Into<Message> + WasmCompatSend,
    ) -> Self::TypedRequest<T>
       where T: JsonSchema + DeserializeOwned + WasmCompatSend;
}
Expand description

High-level typed structured prompting for the classic runtime.

Required Associated Types§

Source

type TypedRequest<T>: IntoFuture<Output = Result<T, StructuredOutputError>> where T: JsonSchema + DeserializeOwned + WasmCompatSend + 'static

Request type returned for one target output type.

Required Methods§

Source

fn prompt_typed<T>( &self, prompt: impl Into<Message> + WasmCompatSend, ) -> Self::TypedRequest<T>

Send a prompt and deserialize the accepted structured response as T.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<M> TypedPrompt for &Agent<M>
where M: CompletionModel + 'static,

Source§

type TypedRequest<T> = TypedPromptRequest<T, Standard, M> where T: JsonSchema + DeserializeOwned + WasmCompatSend + 'static

Source§

impl<M> TypedPrompt for Agent<M>
where M: CompletionModel + 'static,

Source§

type TypedRequest<T> = TypedPromptRequest<T, Standard, M> where T: JsonSchema + DeserializeOwned + WasmCompatSend + 'static