Root of every quantmind knowledge type. All three shapes (Flatten / Tree / Graph) share this field set; subclasses add domain-specific payload. Subclasses MUST override `embedding_text()` to declare what string the store layer should embed.
| 64 | run_id: UUID | None = None |
| 65 | extracted_at: datetime |
| 66 | |
| 67 | |
| 68 | class ArtifactMeta(BaseModel): |
| 69 | """Minimal provenance for a derived, self-contained artifact. |
| 70 | |
| 71 | A derived artifact (for example a page-preserving structure tree) is not |
| 72 | canonical ``BaseKnowledge``: it is rebuildable from its source. It still |
| 73 | needs the light provenance carried here to be stored and time-queried on its |
| 74 | own — an information cutoff (``as_of``), a typed light source reference, and |
| 75 | the exact content hash of the source revision it was derived from. Kept |
| 76 | deliberately small so several artifact shapes can mix it in without |
| 77 | inheriting the full canonical-knowledge field set. |
| 78 | |
| 79 | This provenance is metadata, never identity: it must stay out of an |
| 80 | artifact's ``id`` and ``content_hash`` so a rebuild at a different wall-clock |
| 81 | time yields the identical artifact. |
| 82 | """ |
| 83 | |
| 84 | model_config = ConfigDict(extra="forbid", frozen=True) |
| 85 | |
| 86 | as_of: datetime = Field(..., description="Information cutoff time.") |
| 87 | source: SourceRef |
| 88 | source_title: str | None = None |
| 89 | source_content_hash: str = Field(pattern=r"^[0-9a-f]{64}$") |
| 90 | |
| 91 | |
| 92 | class BaseKnowledge(BaseModel): |
| 93 | """Root of every quantmind knowledge type. |
| 94 | |
| 95 | All three shapes (Flatten / Tree / Graph) share this field set; subclasses |
| 96 | add domain-specific payload. Retrieval-specific text selection belongs to |
| 97 | the library indexing boundary. |
| 98 | """ |
| 99 | |
| 100 | model_config = ConfigDict(extra="forbid", frozen=True) |
| 101 | |
| 102 | # Identity |
| 103 | id: UUID = Field(default_factory=uuid4) |
| 104 | item_type: str |
| 105 | schema_version: str = "1.0" |
| 106 | |
| 107 | # Time (financial mandate) |
| 108 | as_of: datetime = Field(..., description="Information cutoff time.") |
| 109 | available_at: datetime | None = Field( |
| 110 | default=None, |
| 111 | description="Time the source became observable to researchers.", |
| 112 | ) |
| 113 | created_at: datetime = Field( |
| 114 | default_factory=lambda: datetime.now(timezone.utc) |
| 115 | ) |
| 116 | |
| 117 | # Provenance (no bare strings) |
| 118 | source: SourceRef |
| 119 | extraction: ExtractionRef | None = None |
| 120 | |
| 121 | # Trust |
| 122 | confidence: Literal["low", "medium", "high"] = "medium" |
| 123 |
nothing calls this directly
no outgoing calls
no test coverage detected