KnowledgeGraph.search()

Search nodes by name or content (case-insensitive substring match).

Usage

Source

KnowledgeGraph.search(
    query,
    *,
    node_type=None,
    limit=20,
)

Parameters

query: str

Text to search for in node names and content.

node_type: NodeType | None = None

Optional filter by node type.

limit: int = 20
Maximum results to return.

Returns

list[Node]
Matching nodes, name matches ranked first.

Examples

results = kg.search("python", node_type=tb.NodeType.ENTITY)