Engram Class
Represents a unit of memory, consisting of a text string (e.g., a phrase, sentence, or paragraph) along with contextual information that helps in retrieval and responses.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
A unique identifier for the engram. |
locations |
list[str]
|
One or more locations where the engram was generated such as file paths or URLs. |
source_ids |
list[str]
|
One or more identifiers linking the engram to its originating sources. |
content |
str
|
The textual content of the engram. |
is_native_source |
bool
|
Whether the content is directly extracted from a source (True) or derived/generated (False). |
context |
dict[str, str] | None
|
Optional key-value pairs providing additional context for the engram. |
indices |
list[Index] | None
|
Optional list of semantic indices associated with the engram, typically used for embedding-based search. |
meta_ids |
list[str] | None
|
Optional metadata identifiers associated with this Engram. |
library_ids |
list[str] | None
|
Optional identifiers grouping this engram into document collections or libraries. |
accuracy |
int | None
|
An optional accuracy score assigned to the engram by validation on the Codify Service). |
relevancy |
int | None
|
An optional relevancy score assigned to the engram by validation on the Codify Service). |
created_date |
datetime | None
|
The creation timestamp of the engram. |
Methods:
Name | Description |
---|---|
generate_toml |
Serializes the engram to a TOML-formatted string, including all non-null attributes and flattening indices. |
Source code in src/engramic/core/engram.py
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 94 |
|