Skip to content

Commit ebec44b

Browse files
committed
feat: add annotation to item
1 parent 9c543bc commit ebec44b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/memos/memories/textual/item.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@
1313

1414

1515
class SourceMessage(BaseModel):
16+
"""
17+
Purpose: **memory provenance / traceability**.
18+
19+
Capture the minimal, reproducible origin context of a memory item so it can be
20+
audited, traced, rolled back, or de-duplicated later.
21+
22+
Fields & conventions:
23+
- type: Source kind (e.g., "chat", "doc", "web", "file", "system", ...).
24+
If not provided, upstream logic may infer it:
25+
presence of `role` ⇒ "chat"; otherwise ⇒ "doc".
26+
- role: Conversation role ("user" | "assistant" | "system") when the
27+
source is a chat turn.
28+
- content: Minimal reproducible snippet from the source. If omitted,
29+
upstream may fall back to `doc_path` / `url` / `message_id`.
30+
- chat_time / message_id / doc_path: Locators for precisely pointing back
31+
to the original record (timestamp, message id, document path).
32+
- Extra fields: Allowed (`model_config.extra="allow"`) to carry arbitrary
33+
provenance attributes (e.g., url, page, offset, span, local_confidence).
34+
"""
35+
1636
type: str | None = "chat"
1737
role: Literal["user", "assistant", "system"] | None = None
1838
chat_time: str | None = None

0 commit comments

Comments
 (0)