pub struct LlmRequest {
pub contents: Vec<Content>,
pub model: Option<String>,
pub system_instruction: Option<String>,
pub tools: Vec<Tool>,
pub temperature: Option<f32>,
pub max_output_tokens: Option<u32>,
pub top_p: Option<f32>,
pub top_k: Option<u32>,
pub stop_sequences: Vec<String>,
pub thinking_budget: Option<u32>,
pub response_mime_type: Option<String>,
pub response_json_schema: Option<Value>,
}Expand description
Configuration for an LLM generation request.
Every field a provider can honour is here, and GeminiLlm sends every
one of them. New fields may be added; build requests with
..Default::default() or LlmRequest::from_text.
Fields§
§contents: Vec<Content>The messages/contents to send.
model: Option<String>The model for this request, overriding the provider’s default model
(e.g. "gemini-2.5-pro"). None uses BaseLlm::model_id.
system_instruction: Option<String>System instruction.
tools: Vec<Tool>Available tools.
temperature: Option<f32>Temperature for generation.
max_output_tokens: Option<u32>Maximum output tokens.
top_p: Option<f32>Nucleus sampling threshold.
top_k: Option<u32>Number of highest-probability tokens to sample from.
stop_sequences: Vec<String>Strings that end generation when produced.
thinking_budget: Option<u32>Token budget for the model’s thinking, on models that think.
response_mime_type: Option<String>MIME type for structured output (e.g., "application/json").
response_json_schema: Option<Value>JSON Schema for structured output. Requires response_mime_type = "application/json".
Implementations§
Source§impl LlmRequest
impl LlmRequest
Sourcepub fn from_text(text: impl Into<String>) -> LlmRequest
pub fn from_text(text: impl Into<String>) -> LlmRequest
Create a request from a single user message.
Sourcepub fn from_contents(contents: Vec<Content>) -> LlmRequest
pub fn from_contents(contents: Vec<Content>) -> LlmRequest
Create a request from existing contents.
Trait Implementations§
Source§impl Clone for LlmRequest
impl Clone for LlmRequest
Source§fn clone(&self) -> LlmRequest
fn clone(&self) -> LlmRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LlmRequest
impl Debug for LlmRequest
Source§impl Default for LlmRequest
impl Default for LlmRequest
Source§fn default() -> LlmRequest
fn default() -> LlmRequest
Source§impl<'de> Deserialize<'de> for LlmRequest
impl<'de> Deserialize<'de> for LlmRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LlmRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LlmRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for LlmRequest
impl Serialize for LlmRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for LlmRequest
impl RefUnwindSafe for LlmRequest
impl Send for LlmRequest
impl Sync for LlmRequest
impl Unpin for LlmRequest
impl UnwindSafe for LlmRequest
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,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].