Skip to main content

windmill_api/models/
memory_compaction.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.824.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// MemoryCompaction : Keeps the whole memory named by the run's memory id (or the step's `memory_id`), replacing its older part with a summary as the conversation approaches the model's context window. Without a memory id the agent runs without memory, and compaction bounds the run's own loop. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct MemoryCompaction {
17    #[serde(rename = "kind")]
18    pub kind: Kind,
19    /// Overrides the context window looked up from the model, in tokens. Only a model Windmill does not know needs one; those fall back to 128000. 
20    #[serde(rename = "context_window", skip_serializing_if = "Option::is_none")]
21    pub context_window: Option<i32>,
22}
23
24impl MemoryCompaction {
25    /// Keeps the whole memory named by the run's memory id (or the step's `memory_id`), replacing its older part with a summary as the conversation approaches the model's context window. Without a memory id the agent runs without memory, and compaction bounds the run's own loop. 
26    pub fn new(kind: Kind) -> MemoryCompaction {
27        MemoryCompaction {
28            kind,
29            context_window: None,
30        }
31    }
32}
33/// 
34#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
35pub enum Kind {
36    #[serde(rename = "compaction")]
37    Compaction,
38}
39
40impl Default for Kind {
41    fn default() -> Kind {
42        Self::Compaction
43    }
44}
45