koi_net.protocol.knowledge_object
Classes
|
A normalized knowledge representation for internal processing. |
- class koi_net.protocol.knowledge_object.KnowledgeObject(**data)[source]
Bases:
BaseModelA normalized knowledge representation for internal processing.
Represents an RID, manifest, bundle, or event. Contains three fields (
normalized_event_type,source,network_targets) used for decision making in the knowledge processing pipeline.The source indicates which node this object originated from, or
Noneif it was generated by this node.The normalized event type indicates how the knowledge object is viewed from the perspective of this node, and what cache actions will take place. (
NEW,UPDATE) -> cache write,FORGET-> cache delete,None-> no cache action, and end of pipeline.The network targets indicate other nodes in the network this knowledge object will be sent to. The event sent to them will be constructed from this knowledge object’s RID, manifest, contents, and normalized event type.
- Parameters:
- property bundle: Bundle
Bundle representation of knowledge object.
- contents: dict | None
- classmethod from_bundle(bundle, event_type=None, source=None)[source]
Creates a
KnowledgeObjectfrom aBundle.- Return type:
- Parameters:
bundle (Bundle)
event_type (EventType | None)
source (KoiNetNode | None)
- classmethod from_event(event, source=None)[source]
Creates a
KnowledgeObjectfrom anEvent.- Return type:
- Parameters:
event (Event)
source (KoiNetNode | None)
- classmethod from_manifest(manifest, event_type=None, source=None)[source]
Creates a
KnowledgeObjectfrom aManifest.- Return type:
- Parameters:
manifest (Manifest)
event_type (EventType | None)
source (KoiNetNode | None)
- classmethod from_rid(rid, event_type=None, source=None)[source]
Creates a
KnowledgeObjectfrom anRID.- Return type:
- Parameters:
rid (RID)
event_type (EventType | None)
source (KoiNetNode | None)
- manifest: Manifest | None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- network_targets: set[KoiNetNode]
- prev_bundle: Bundle | None
- rid: RID
- source: KoiNetNode | None