Skip to main content

openai_interface/conversations/
mod.rs

1//! The Conversations API: manage conversation state via `/conversations`.
2//!
3//! > ![warn] This module is untested!
4//! > If you encounter any issues, please report them on the repository.
5//!
6//! Conversations are the stateful layer of the Responses API: a
7//! conversation stores the input/output items of a multi-turn
8//! interaction, and a Responses request can continue it via
9//! `conversation: { "id": ... }` instead of `previous_response_id`.
10//! See
11//! [the OpenAI Conversations guide](https://platform.openai.com/docs/guides/conversations).
12//!
13//! Submodules: [`create`], [`retrieve`], [`update`], [`delete`],
14//! [`list`] and [`items`] (per-conversation item management).
15
16pub mod create;
17pub mod delete;
18pub mod items;
19pub mod list;
20pub mod retrieve;
21pub mod update;
22
23/// A conversation object.
24#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
25pub struct Conversation {
26    /// The conversation ID, e.g. `conv_...`.
27    pub id: String,
28    /// The object type, always `conversation`.
29    #[serde(default)]
30    pub object: Option<String>,
31    /// Unix timestamp (seconds) of when the conversation was created.
32    #[serde(default)]
33    pub created_at: Option<u64>,
34    /// Arbitrary key-value metadata attached to the conversation.
35    #[serde(default)]
36    pub metadata: Option<std::collections::HashMap<String, String>>,
37}
38
39crate::impl_from_str!(Conversation);