pub struct GenerateRequest {
pub prompt: String,
pub model: Option<String>,
pub params: GenerateParams,
pub context: Option<String>,
pub tools: Option<Vec<Value>>,
pub images: Option<Vec<ContentBlock>>,
pub messages: Option<Vec<Message>>,
pub cache_control: bool,
pub response_format: Option<ResponseFormat>,
pub intent: Option<IntentHint>,
}Expand description
A text generation request.
Default is derived so call sites can mutate just the fields
they care about: GenerateRequest { prompt: "...".into(), ..Default::default() }.
The default prompt = "" is useless on its own — callers always
override it — but the ..Default::default() shorthand stops the
per-call-site mechanical churn every time a new optional field
lands (closes #109).
Fields§
§prompt: StringThe prompt to complete (first user message for single-turn).
model: Option<String>Optional model override.
params: GenerateParamsGeneration parameters.
context: Option<String>Optional memory context to prepend to the prompt. When provided, this is injected as a system-level context block before the user prompt, grounding the model’s response.
tools: Option<Vec<Value>>Optional tool definitions for structured tool_use. When provided, the model may return tool_calls instead of text. Each tool is a JSON object with: name, description, parameters (JSON Schema).
images: Option<Vec<ContentBlock>>Optional images for vision models.
When provided with a single-turn prompt, these are included as image content blocks
in the user message. For multi-turn with messages, use UserMultimodal variants instead.
messages: Option<Vec<Message>>Optional multi-turn conversation history.
When provided, the backend builds a proper multi-turn message array
instead of a single user message. The prompt field is ignored when
messages are present.
cache_control: boolEnable prompt caching for Anthropic API. When true, system prompt and tools are marked with cache_control breakpoints, enabling cache reuse across parent/child agent calls sharing the same prefix.
response_format: Option<ResponseFormat>Constrain output to JSON (optionally schema-validated). See
ResponseFormat for the per-provider mapping. Defaults to
None — free-form text.
intent: Option<IntentHint>Caller-supplied routing intent. None preserves the existing
adaptive vs. pinned-model behavior. When Some, the adaptive
router uses the hint to filter candidates (hard require),
override task selection, and bias the score profile
(prefer_local). See crate::intent::IntentHint.
Trait Implementations§
Source§impl Clone for GenerateRequest
impl Clone for GenerateRequest
Source§fn clone(&self) -> GenerateRequest
fn clone(&self) -> GenerateRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenerateRequest
impl Debug for GenerateRequest
Source§impl Default for GenerateRequest
impl Default for GenerateRequest
Source§fn default() -> GenerateRequest
fn default() -> GenerateRequest
Source§impl<'de> Deserialize<'de> for GenerateRequest
impl<'de> Deserialize<'de> for GenerateRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GenerateRequest
impl RefUnwindSafe for GenerateRequest
impl Send for GenerateRequest
impl Sync for GenerateRequest
impl Unpin for GenerateRequest
impl UnsafeUnpin for GenerateRequest
impl UnwindSafe for GenerateRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more