Skip to content

@graphty/graphty-element / ai / SchemaManager

Class: SchemaManager ​

Defined in: graphty-element/src/ai/schema/SchemaManager.ts:22

Manages the lifecycle of schema extraction and caching.

Features:

  • Lazy extraction on first access
  • Caching of both raw schema and formatted output
  • Cache invalidation for data change updates
  • Pass-through options to SchemaExtractor

Constructors ​

Constructor ​

new SchemaManager(graph, options?): SchemaManager

Defined in: graphty-element/src/ai/schema/SchemaManager.ts:33

Create a new SchemaManager.

Parameters ​

graph ​

Graph

The graph to extract schema from

options? ​

SchemaExtractorOptions = {}

Options passed through to SchemaExtractor

Returns ​

SchemaManager

Methods ​

extract() ​

extract(): SchemaSummary

Defined in: graphty-element/src/ai/schema/SchemaManager.ts:44

Extract schema from the graph.

Returns cached schema if available, otherwise extracts fresh.

Returns ​

SchemaSummary

The extracted schema summary


getFormattedSchema() ​

getFormattedSchema(): string

Defined in: graphty-element/src/ai/schema/SchemaManager.ts:67

Get the schema formatted as markdown for system prompts.

Returns cached formatted schema if available.

Returns ​

string

Formatted markdown string


getSchema() ​

getSchema(): SchemaSummary | null

Defined in: graphty-element/src/ai/schema/SchemaManager.ts:57

Get the cached schema without triggering extraction.

Returns ​

SchemaSummary | null

The cached schema or null if not yet extracted


invalidateCache() ​

invalidateCache(): void

Defined in: graphty-element/src/ai/schema/SchemaManager.ts:82

Invalidate the cached schema.

Call this when graph data changes to force re-extraction on the next access.

Returns ​

void