sync()
Sync documents from connectors into a knowledge graph.
Usage
sync(
kg,
*connectors,
node_prefix="doc",
)Performs incremental sync: only adds or updates documents whose content has changed since the last sync. Optionally removes nodes whose source documents no longer exist.
Parameters
kg: Any-
A
~talk_box.knowledge_graph.KnowledgeGraphinstance. *connectors: Connector-
One or more Connector instances to sync from.
node_prefix: str = "doc"-
Prefix for generated node IDs (default
"doc").
Returns
SyncResult- Summary of what was added, updated, and unchanged.
Examples
import talk_box as tb
kg = tb.KnowledgeGraph(":memory:")
md = tb.MarkdownDir("~/notes/")
result = tb.sync(kg, md)
result.added # 5
result.updated # 2