memoryscope.scheme.memory_node

pydantic model memoryscope.scheme.memory_node.MemoryNode[source]

Bases: BaseModel

Represents a memory node with comprehensive attributes to store memory information including unique ID, user details, content, metadata, scoring metrics. Automatically handles timestamp conversion to date format during initialization.

Show JSON schema
{
   "title": "MemoryNode",
   "description": "Represents a memory node with comprehensive attributes to store memory information including unique ID,\nuser details, content, metadata, scoring metrics.\nAutomatically handles timestamp conversion to date format during initialization.",
   "type": "object",
   "properties": {
      "memory_id": {
         "description": "unique id for memory",
         "title": "Memory Id",
         "type": "string"
      },
      "user_name": {
         "default": "",
         "description": "the user who owns the memory",
         "title": "User Name",
         "type": "string"
      },
      "target_name": {
         "default": "",
         "description": "target name described by the memory",
         "title": "Target Name",
         "type": "string"
      },
      "meta_data": {
         "additionalProperties": {
            "type": "string"
         },
         "default": {},
         "description": "meta data infos",
         "title": "Meta Data",
         "type": "object"
      },
      "content": {
         "default": "",
         "description": "memory content",
         "title": "Content",
         "type": "string"
      },
      "key": {
         "default": "",
         "description": "memory key",
         "title": "Key",
         "type": "string"
      },
      "key_vector": {
         "default": [],
         "description": "memory key embedding result",
         "items": {
            "type": "number"
         },
         "title": "Key Vector",
         "type": "array"
      },
      "value": {
         "default": "",
         "description": "memory value",
         "title": "Value",
         "type": "string"
      },
      "score_recall": {
         "default": 0,
         "description": "embedding similarity score used in recall stage",
         "title": "Score Recall",
         "type": "number"
      },
      "score_rank": {
         "default": 0,
         "description": "rank model score used in rank stage",
         "title": "Score Rank",
         "type": "number"
      },
      "score_rerank": {
         "default": 0,
         "description": "rerank score used in rerank stage",
         "title": "Score Rerank",
         "type": "number"
      },
      "memory_type": {
         "default": "",
         "description": "conversation / observation / insight...",
         "title": "Memory Type",
         "type": "string"
      },
      "action_status": {
         "default": "none",
         "description": "new / content_modified / modified / deleted / none",
         "title": "Action Status",
         "type": "string"
      },
      "store_status": {
         "default": "valid",
         "description": "store_status: valid / expired",
         "title": "Store Status",
         "type": "string"
      },
      "vector": {
         "default": [],
         "description": "content embedding result",
         "items": {
            "type": "number"
         },
         "title": "Vector",
         "type": "array"
      },
      "timestamp": {
         "description": "timestamp of the memory node",
         "title": "Timestamp",
         "type": "integer"
      },
      "dt": {
         "default": "",
         "description": "dt of the memory node",
         "title": "Dt",
         "type": "string"
      },
      "obs_reflected": {
         "default": 0,
         "description": "if the observation is reflected: 0/1",
         "title": "Obs Reflected",
         "type": "integer"
      },
      "obs_updated": {
         "default": 0,
         "description": "if the observation has updated user profile or insight: 0/1",
         "title": "Obs Updated",
         "type": "integer"
      }
   }
}

Fields:
field memory_id: str [Optional]

unique id for memory

field user_name: str = ''

the user who owns the memory

field target_name: str = ''

target name described by the memory

field meta_data: Dict[str, str] = {}

meta data infos

field content: str = ''

memory content

field key: str = ''

memory key

field key_vector: List[float] = []

memory key embedding result

field value: str = ''

memory value

field score_recall: float = 0

embedding similarity score used in recall stage

field score_rank: float = 0

rank model score used in rank stage

field score_rerank: float = 0

rerank score used in rerank stage

field memory_type: str = ''

conversation / observation / insight…

field action_status: str = 'none'

new / content_modified / modified / deleted / none

field store_status: str = 'valid'

store_status: valid / expired

field vector: List[float] = []

content embedding result

field timestamp: int [Optional]

timestamp of the memory node

field obs_reflected: int = 0

if the observation is reflected: 0/1

field obs_updated: int = 0

if the observation has updated user profile or insight: 0/1

__init__(**kwargs)[source]

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

field dt: str = ''

dt of the memory node

property node_keys