KnowledgeSnapshot class
A parsed bundle projection with original citation locations and graph edges. Indexes and logs remain navigation/history, rather than duplicate passages.
Constructors
-
KnowledgeSnapshot.fromMap(Map<
String, Object?> map) -
Reopens saved passages without tokenization or embedding inference.
Graph and typed metadata meanings are reconstructed by upstream OKF.
factory
-
KnowledgeSnapshot.fromSources(Map<
String, String> sources, {required String bundleId, Iterable<String> assets = const [], int maxChunkLength = 1000}) -
Parses source text through OKF; producer-defined metadata is retained.
bundleIdmust be stable across updates and unique within a shared store.factory
Properties
-
assets
→ List<
String> -
final
- bundleId → String
-
final
-
chunks
→ List<
Chunk> -
final
-
conceptPaths
→ Set<
String> -
no setter
- graph → OkfGraph
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sources
→ Map<
String, String> -
Original inputs retained to rebuild upstream OKF graph/metadata semantics.
final
Methods
-
fitInputs(
{required Future< int> countTokens(String), required int maxTokens, required bool includeContext}) → Future<KnowledgeSnapshot> - Splits oversized passages at whitespace using the actual tokenizer. Preserves text, character spans, and citation lines. Context counts against the budget; if context plus one word cannot fit, throws without truncation.
-
metadataFor(
String path) → OkfMetadata - Typed OKF metadata, with its upstream defaults and trust semantics.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
textFor(
Chunk chunk, {required bool includeContext}) → String - Retrieval input; the original source passage is never overwritten.
-
toMap(
) → Map< String, Object?> - A versioned, lossless projection including fitted passages and citations. Commit this with the corresponding store and embedding configuration.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited