pub struct AnnotatedLlmRequest {Show 19 fields
pub messages: Vec<Message>,
pub model: Option<String>,
pub params: Option<GenerationParams>,
pub tools: Option<Vec<ToolDefinition>>,
pub tool_choice: Option<ToolChoice>,
pub store: Option<bool>,
pub previous_response_id: Option<String>,
pub truncation: Option<Json>,
pub reasoning: Option<Json>,
pub include: Option<Json>,
pub user: Option<String>,
pub metadata: Option<Json>,
pub service_tier: Option<String>,
pub parallel_tool_calls: Option<bool>,
pub max_output_tokens: Option<u64>,
pub max_tool_calls: Option<u64>,
pub top_logprobs: Option<u64>,
pub stream: Option<bool>,
pub extra: Map<String, Json>,
}Expand description
Structured view of an LLM request, produced by a Codec from opaque
LlmRequest content.
The extra field captures any provider-specific keys not modeled by the
known fields, ensuring lossless round-trip through decode/encode.
Fields§
§messages: Vec<Message>Parsed conversation messages.
model: Option<String>Model identifier (e.g., "gpt-4", "claude-sonnet-4-20250514").
params: Option<GenerationParams>Common generation parameters, normalized.
tools: Option<Vec<ToolDefinition>>Tool definitions (function schemas) available to the model.
tool_choice: Option<ToolChoice>Tool choice control.
store: Option<bool>OpenAI Responses: whether to persist response state server-side.
previous_response_id: Option<String>OpenAI Responses: prior response to continue from.
truncation: Option<Json>OpenAI Responses: context truncation behavior.
reasoning: Option<Json>OpenAI Responses: reasoning configuration object.
include: Option<Json>OpenAI Responses: include filter for additional output/state items.
user: Option<String>OpenAI user identifier.
metadata: Option<Json>OpenAI metadata map/object.
service_tier: Option<String>OpenAI service tier preference.
parallel_tool_calls: Option<bool>OpenAI tool parallelism toggle.
max_output_tokens: Option<u64>OpenAI Responses max output token limit.
max_tool_calls: Option<u64>OpenAI Responses max tool calls.
top_logprobs: Option<u64>OpenAI logprob fanout count.
stream: Option<bool>OpenAI streaming toggle.
extra: Map<String, Json>Extensible key-value pairs for unmodeled provider-specific fields.
Merged back into the request body during encode via serde(flatten).
Implementations§
Source§impl AnnotatedLlmRequest
impl AnnotatedLlmRequest
Sourcepub fn system_prompt(&self) -> Option<&str>
pub fn system_prompt(&self) -> Option<&str>
Extract the text content of the first system message, if any.
For MessageContent::Text, returns the string directly.
For MessageContent::Parts, returns the text of the first
ContentPart::Text part.
Sourcepub fn last_user_message(&self) -> Option<&str>
pub fn last_user_message(&self) -> Option<&str>
Get the text content of the last user message, if any.
Searches messages in reverse order and returns the first user
message found. For MessageContent::Parts, returns the text of
the first ContentPart::Text part.
Sourcepub fn has_tool_calls(&self) -> bool
pub fn has_tool_calls(&self) -> bool
Check if any assistant message in the conversation contains tool calls.
Returns true if at least one Message::Assistant variant has a
non-empty tool_calls field.
Trait Implementations§
Source§impl Clone for AnnotatedLlmRequest
impl Clone for AnnotatedLlmRequest
Source§fn clone(&self) -> AnnotatedLlmRequest
fn clone(&self) -> AnnotatedLlmRequest
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 AnnotatedLlmRequest
impl Debug for AnnotatedLlmRequest
Source§impl<'de> Deserialize<'de> for AnnotatedLlmRequest
impl<'de> Deserialize<'de> for AnnotatedLlmRequest
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>,
Source§impl PartialEq for AnnotatedLlmRequest
impl PartialEq for AnnotatedLlmRequest
Source§fn eq(&self, other: &AnnotatedLlmRequest) -> bool
fn eq(&self, other: &AnnotatedLlmRequest) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for AnnotatedLlmRequest
impl Serialize for AnnotatedLlmRequest
impl StructuralPartialEq for AnnotatedLlmRequest
Auto Trait Implementations§
impl Freeze for AnnotatedLlmRequest
impl RefUnwindSafe for AnnotatedLlmRequest
impl Send for AnnotatedLlmRequest
impl Sync for AnnotatedLlmRequest
impl Unpin for AnnotatedLlmRequest
impl UnsafeUnpin for AnnotatedLlmRequest
impl UnwindSafe for AnnotatedLlmRequest
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request