Engram Class
Represents a unit of memory that encapsulates a text fragment with rich metadata for semantic indexing and contextual relevance.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
Unique identifier for the engram. |
locations |
list[str]
|
One or more file paths, URLs, or other locations associated with the engram. |
source_ids |
list[str]
|
Identifiers of the original source documents from which the engram was derived. |
content |
str
|
The main textual content of the engram. |
engram_type |
EngramType
|
Type of the engram (native, episodic, procedural, or artifact). |
context |
dict[str, str] | None
|
Optional contextual metadata in key-value format to enhance retrieval or classification. Defaults to None. |
indices |
list[Index] | None
|
Optional semantic indices, typically for vector-based retrieval. Defaults to None. |
meta_ids |
list[str] | None
|
Optional list of metadata tags or identifiers relevant to the engram. Defaults to None. |
repo_ids |
list[str] | None
|
Optional identifiers linking this engram to repositories or code bases. Defaults to None. |
accuracy |
int | None
|
Optional accuracy score assigned during validation (e.g., via Codify Service). Defaults to 0. |
relevancy |
int | None
|
Optional relevancy score assigned during validation (e.g., via Codify Service). Defaults to 0. |
created_date |
int | None
|
Optional Unix timestamp representing the creation time of the engram. Defaults to None. |
Methods:
Name | Description |
---|---|
generate_toml |
Serializes the engram into a TOML-formatted string, including non-null fields. Nested indices are flattened, and context is rendered as an inline TOML table. |
Source code in src/engramic/core/engram.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|