Arcana.Graph.EntityExtractor.LLM (Arcana v2.0.1)

Copy Markdown View Source

LLM-based entity extraction implementation.

Uses structured prompts to identify named entities from text. The LLM returns JSON-formatted entities with name, type, and optional description.

This extractor is useful when you want to use the same LLM for both entity and relationship extraction, or when you need domain-specific entity recognition.

Usage

# Configure with an LLM function
extractor = {Arcana.Graph.EntityExtractor.LLM, llm: my_llm_fn}
{:ok, entities} = EntityExtractor.extract(extractor, "Sam Altman leads OpenAI")

Configuration

config :arcana, :graph,
  entity_extractor: {Arcana.Graph.EntityExtractor.LLM, []}

When using this extractor, the LLM function is passed automatically from the graph pipeline.

Options

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

  • :types - Optional. List of entity types to extract. Defaults to all standard types.

Summary

Functions

Builds the prompt for entity extraction.

Functions

build_prompt(text, types)

Builds the prompt for entity extraction.