pub struct AnnotatedLlmRequest {Show 21 fields
pub messages: Vec<Message>,
pub instructions: Option<MessageContent>,
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<Value>,
pub reasoning: Option<Value>,
pub include: Option<Value>,
pub user: Option<String>,
pub metadata: Option<Value>,
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 api_specific: Option<ApiSpecificRequest>,
pub extra: Map<String, Value>,
}Expand description
Structured view of an LLM request, produced by a Codec from opaque
LlmRequest content.
The extra field captures unknown future top-level keys. Modeled
provider-specific controls belong in AnnotatedLlmRequest::api_specific.
Fields§
§messages: Vec<Message>Parsed conversation messages.
instructions: Option<MessageContent>Provider-level instructions that are not part of the conversation array.
Anthropic encodes this as system; OpenAI Responses uses instructions.
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<Value>OpenAI Responses: context truncation behavior.
reasoning: Option<Value>OpenAI Responses: reasoning configuration object.
include: Option<Value>OpenAI Responses: include filter for additional output/state items.
user: Option<String>OpenAI user identifier.
metadata: Option<Value>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.
api_specific: Option<ApiSpecificRequest>API-specific request data that does not have portable semantics.
extra: Map<String, Value>Unknown future top-level fields.
Baseline-aware codecs remove deleted keys and overlay changed or added keys without rebuilding untouched provider JSON.
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 Default for AnnotatedLlmRequest
impl Default for AnnotatedLlmRequest
Source§fn default() -> AnnotatedLlmRequest
fn default() -> AnnotatedLlmRequest
Source§impl<'de> Deserialize<'de> for AnnotatedLlmRequest
impl<'de> Deserialize<'de> for AnnotatedLlmRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnnotatedLlmRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnnotatedLlmRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AnnotatedLlmRequest
impl PartialEq for AnnotatedLlmRequest
Source§impl Serialize for AnnotatedLlmRequest
impl Serialize for AnnotatedLlmRequest
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,
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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 moreSource§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