MemoryId (src/memory.rs)

openfang · crates/openfang-types/src/memory.rs · rust · Apache-2.0
ai

Defines memory identifiers, fragments, filters, and graph entities for a semantic store.

// Source: https://github.com/RightNow-AI/openfang | License: Apache-2.0 | Copyright 2024 OpenFang Contributors
// Provided via justclaw.it.com; keep this notice with the code.
//! Memory substrate types: fragments, sources, filters, and the unified Memory trait.

use crate::agent::AgentId;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use uuid::Uuid;

/// Unique identifier for a memory fragment.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct MemoryId(pub Uuid);

impl MemoryId {
    /// Create a new random MemoryId.
    pub fn new() -> Self {
        Self(Uuid::new_v4())
    }
}

impl Default for MemoryId {
    fn default() -> Self {
        Self::new()
    }
}

impl std:

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key