Arcana.Graph.RelationshipExtractor.LLM (Arcana v1.3.3)

View Source

LLM-based relationship extraction implementation.

Uses structured prompts to identify semantic relationships between previously extracted entities. The LLM returns JSON-formatted relationships with type, description, and strength.

Usage

# Configure with an LLM function
extractor = {Arcana.Graph.RelationshipExtractor.LLM, llm: my_llm_fn}
{:ok, relationships} = RelationshipExtractor.extract(extractor, text, entities)

Options

  • :llm - Required. An LLM function (prompt, context, opts) -> {:ok, response} | {:error, reason}

Summary

Functions

Builds the prompt for relationship extraction.

Functions

build_prompt(text, entities)

Builds the prompt for relationship extraction.

The prompt includes the source text and a list of entities for the LLM to find relationships between.