pub struct InputItem {
pub item_type: String,
pub role: Option<String>,
pub content: Option<Value>,
}Expand description
Input item for creating conversation items.
Used when adding new items to a conversation.
Fields§
§item_type: StringThe type of item (e.g., “message”)
role: Option<String>The role of the item (e.g., “user”, “assistant”)
content: Option<Value>The content of the item (can be a string or structured content)
Implementations§
Source§impl InputItem
impl InputItem
Sourcepub fn message(role: &str, content: &str) -> Self
pub fn message(role: &str, content: &str) -> Self
Creates a new message item.
§Arguments
role- The role of the message (e.g., “user”, “assistant”)content- The text content of the message
§Example
use openai_tools::conversations::response::InputItem;
let item = InputItem::message("user", "Hello, how are you?");
assert_eq!(item.item_type, "message");
assert_eq!(item.role, Some("user".to_string()));Sourcepub fn user_message(content: &str) -> Self
pub fn user_message(content: &str) -> Self
Sourcepub fn assistant_message(content: &str) -> Self
pub fn assistant_message(content: &str) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for InputItem
impl<'de> Deserialize<'de> for InputItem
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InputItem
impl RefUnwindSafe for InputItem
impl Send for InputItem
impl Sync for InputItem
impl Unpin for InputItem
impl UnsafeUnpin for InputItem
impl UnwindSafe for InputItem
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
Mutably borrows from an owned value. Read more