pub struct Request<'a, C: ?Sized> { /* private fields */ }Expand description
A fluent request being built against a client. Created via RequestExt.
Implementations§
Source§impl<'a, C: ?Sized> Request<'a, C>
impl<'a, C: ?Sized> Request<'a, C>
Sourcepub fn system(self, system: impl Into<String>) -> Self
pub fn system(self, system: impl Into<String>) -> Self
Attach system/context instructions.
Built-in provider clients send this through the provider’s first-class
system field or message role for every terminal. This keeps the static
instruction prefix separate from the dynamic user prompt, which also
improves provider prompt-cache reuse. Custom LLMClient
implementations inherit a backwards-compatible concatenation fallback
unless they override the request hooks on that trait.
Source§impl<C: LLMClient + Sync + ?Sized> Request<'_, C>
impl<C: LLMClient + Sync + ?Sized> Request<'_, C>
Sourcepub async fn materialize<T>(self, prompt: &str) -> Result<T>
pub async fn materialize<T>(self, prompt: &str) -> Result<T>
Materialize a structured T, applying any attached system context and media.
Sourcepub async fn materialize_with_attempts<T>(
self,
prompt: &str,
) -> Result<MaterializeReport<T>, MaterializeFailure>
pub async fn materialize_with_attempts<T>( self, prompt: &str, ) -> Result<MaterializeReport<T>, MaterializeFailure>
Materialize a structured T with cumulative usage and every provider attempt.
Auto Trait Implementations§
impl<'a, C> Freeze for Request<'a, C>where
C: ?Sized,
impl<'a, C> RefUnwindSafe for Request<'a, C>where
C: RefUnwindSafe + ?Sized,
impl<'a, C> Send for Request<'a, C>
impl<'a, C> Sync for Request<'a, C>
impl<'a, C> Unpin for Request<'a, C>where
C: ?Sized,
impl<'a, C> UnsafeUnpin for Request<'a, C>where
C: ?Sized,
impl<'a, C> UnwindSafe for Request<'a, C>where
C: RefUnwindSafe + ?Sized,
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