pub enum InputItem {
ItemReference(ItemReference),
Item(Item),
EasyMessage(EasyInputMessage),
}Expand description
Input item that can be used in the context for generating a response.
This represents the OpenAPI InputItem schema which is an anyOf:
EasyInputMessage- Simple, user-friendly message input (can use string content)Item- Structured items with proper type discrimination (including InputMessage, OutputMessage, tool calls)ItemReferenceParam- Reference to an existing item by ID (type can be null)
Uses untagged deserialization because these types overlap in structure. Order matters: more specific structures are tried first.
§OpenAPI Specification
Corresponds to the InputItem schema: anyOf[EasyInputMessage, Item, ItemReferenceParam]
Variants§
ItemReference(ItemReference)
A reference to an existing item by ID.
Has a required id field and optional type (can be “item_reference” or null).
Must be tried first as it’s the most minimal structure.
Item(Item)
All structured items with proper type discrimination.
Includes InputMessage, OutputMessage, and all tool calls/outputs.
Uses the discriminated Item enum for efficient, type-safe deserialization.
EasyMessage(EasyInputMessage)
A simple, user-friendly message input (EasyInputMessage). Supports string content and can include assistant role for previous responses. Must be tried last as it’s the most flexible structure.
A message input to the model with a role indicating instruction following
hierarchy. Instructions given with the developer or system role take
precedence over instructions given with the user role. Messages with the
assistant role are presumed to have been generated by the model in previous
interactions.
Implementations§
Source§impl InputItem
impl InputItem
Sourcepub fn from_reference(id: impl Into<String>) -> Self
pub fn from_reference(id: impl Into<String>) -> Self
Creates an InputItem from an item reference ID.
Sourcepub fn from_easy_message(message: EasyInputMessage) -> Self
pub fn from_easy_message(message: EasyInputMessage) -> Self
Creates an InputItem from an EasyInputMessage.
Sourcepub fn text_message(role: Role, content: impl Into<String>) -> Self
pub fn text_message(role: Role, content: impl Into<String>) -> Self
Creates a simple text message with the given role and content.