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. |
is_native_source |
bool
|
Indicates if the content was directly extracted (True) or generated (False). |
context |
dict[str, str] | None
|
Optional contextual metadata in key-value format to enhance retrieval or classification. |
indices |
list[Index] | None
|
Optional semantic indices, typically for vector-based retrieval. |
meta_ids |
list[str] | None
|
Optional list of metadata tags or identifiers relevant to the engram. |
repo_ids |
list[str] | None
|
Optional identifiers linking this engram to repositories or code bases. |
accuracy |
int | None
|
Optional accuracy score assigned during validation (e.g., via Codify Service). |
relevancy |
int | None
|
Optional relevancy score assigned during validation (e.g., via Codify Service). |
created_date |
int | None
|
Optional Unix timestamp representing the creation time of the engram. |
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
14 15 16 17 18 19 20 21 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 |
|