Skip to content

LLM Extraction

LLM extraction turns source content into typed edges for graph enrichment. Memory entities are embedded for recall by default, but graph extraction for memory is opt-in.

Provider selection, model configuration, and practical flags for tuning graph quality, including memory-specific extraction policy.

  1. For Docker Compose, set extraction in Admin Config, then save, validate, and apply it. For a non-Compose local process, set the environment before starting the server:
Terminal window
export EXTRACTION_ENABLED=true
  1. Choose provider/model:
Terminal window
export EXTRACTION_PROVIDER=openai
export EXTRACTION_MODEL=gpt-4o-mini
  1. Leave memory extraction in semantic-recall mode unless you explicitly want memory-derived graph edges:
Terminal window
export EXTRACTION_MEMORY_MODE=embed_only

Use extract_durable to extract only durable_memory, or extract_all to extract both durable memory and session context.

  1. Run graph refresh if relationships were sparse:
Terminal window
./bin/pgm-admin reextract --type document --no-edges-only
  1. Tune neighbor expansion when you need thematic links beyond explicit mentions:
Terminal window
export EXTRACTION_SEMANTIC_NEIGHBORS_ENABLED=true
export EXTRACTION_SEMANTIC_NEIGHBORS_MIN_SIMILARITY=0.75
  • Supported providers: openai, anthropic, ollama, openai-compatible.
  • Optional semantic neighbors create related_to edges from embedding similarity.
  • Auto-creation is controlled via EXTRACTION_AUTO_CREATE_ENTITIES and type allowlists.
  • EXTRACTION_MEMORY_MODE=embed_only keeps all memories searchable through embeddings without graph/entity extraction.
  • EXTRACTION_MEMORY_MODE=extract_durable extracts only durable memories.
  • EXTRACTION_MEMORY_MODE=extract_all extracts durable memories and session context.