Skip to content

Graph Builder

Cognipeer Graph Builder

Build queryable text graphs. Turn documents, code, and provider-backed records into a typed graph with deterministic extraction first and optional semantic enrichment after.

  • Package @cognipeer/graph-builder
  • Language TypeScript
  • Inputs Arrays · async iterables · custom providers · local filesystem paths

The API-first path comes first: no CLI, no hosted wrapper required. The default pipeline extracts structure from markdown and code deterministically; LLM enrichment is additive, explicit, and tracked in diagnostics — so you can query nodes, shortest paths, neighbors, and communities against a graph you can fully account for.

ts
import { graphBuilder } from "@cognipeer/graph-builder";

const result = await graphBuilder.fromTexts([
  {
    id: "docs/overview.md",
    title: "Overview",
    path: "docs/overview.md",
    text: "# Overview\n\nSee [Guide](guide.md)."
  },
  {
    id: "docs/guide.md",
    title: "Guide",
    path: "docs/guide.md",
    text: "# Guide\n\nThe guide explains how providers and path-based inputs work."
  }
]);

console.log(result.graph.stats);
console.log(result.query.path("Overview", "Guide"));
console.log(result.artifacts.report);

What it gives you

Deterministic extraction, optional semantic pass

The default pipeline extracts structure from markdown and code without a model call. LLM enrichment is additive, explicit, and tracked in diagnostics.

Output artifacts for analysis and visualization

Emit JSON, report, wiki, and HTML outputs from the same graph, so apps and humans inspect the same model.

Provider and adapter friendly

Bring your own provider, memory facts, or markdown converter without changing the core graph pipeline.

Incremental update path

Update existing graphs by source item instead of rebuilding the full corpus every time your content changes.

Where to go next

Studio · Pulse · Console · Agent SDK and more — the Cognipeer documentation hub