floopy/types/sessions.rs
1use async_openai::types::chat::ChatCompletionRequestMessage;
2use serde::Deserialize;
3
4/// Provenance for one reconstructed exchange.
5#[derive(Debug, Clone, Deserialize)]
6pub struct SessionTurn {
7 /// The originating request id.
8 pub request_id: String,
9 /// RFC3339 timestamp of the originating request.
10 pub created_at: String,
11 /// Model used for the turn.
12 pub model: String,
13 /// Provider used for the turn.
14 pub provider: String,
15}
16
17/// A conversation restored from Floopy's stored logs.
18///
19/// `messages` is chronological (oldest → newest) and is a drop-in for the
20/// `messages` of a follow-up `chat().create(...)` call.
21#[derive(Debug, Clone, Deserialize)]
22pub struct Session {
23 /// The session id.
24 pub session_id: String,
25 /// Reconstructed messages, oldest first.
26 pub messages: Vec<ChatCompletionRequestMessage>,
27 /// Number of stored turns that contributed to `messages`.
28 pub turn_count: i64,
29 /// Stored turns that contributed to `messages`.
30 pub turns: Vec<SessionTurn>,
31}