Skip to main content

gproxy_protocol/openai/
memories.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4use super::common::{OpenAiModelId, OpenAiWireModel, Rest};
5use super::generate_content::responses::ReasoningConfig;
6
7pub type MemorySummarizeWireModel =
8    OpenAiWireModel<MemorySummarizeRequest, MemorySummarizeResponse>;
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
11#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
12pub struct MemorySummarizeRequest {
13    pub model: OpenAiModelId,
14    pub traces: Vec<MemoryTrace>,
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub reasoning: Option<ReasoningConfig>,
17    #[serde(default, flatten)]
18    pub rest: Rest,
19}
20
21#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
22#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
23pub struct MemoryTrace {
24    pub id: String,
25    pub metadata: MemoryTraceMetadata,
26    // No checked-in upstream memory schema exists; preserve proprietary trace items verbatim.
27    pub items: Vec<Value>,
28    #[serde(default, flatten)]
29    pub rest: Rest,
30}
31
32#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
33#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
34pub struct MemoryTraceMetadata {
35    pub source_path: String,
36    #[serde(default, flatten)]
37    pub rest: Rest,
38}
39
40#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
41#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
42pub struct MemorySummarizeResponse {
43    pub output: Vec<MemorySummary>,
44    #[serde(default, flatten)]
45    pub rest: Rest,
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
49#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
50pub struct MemorySummary {
51    #[serde(rename = "trace_summary", alias = "raw_memory")]
52    pub trace_summary: String,
53    pub memory_summary: String,
54    #[serde(default, flatten)]
55    pub rest: Rest,
56}