SchemaGuidedExtractor

org.llm4s.knowledgegraph.extraction.SchemaGuidedExtractor
class SchemaGuidedExtractor(llmClient: LLMClient)

Extracts a Knowledge Graph from text using schema-constrained LLM prompts.

Unlike the free-form KnowledgeGraphGenerator, this extractor guides the LLM by listing the allowed entity types, relationship types, and expected properties from an ExtractionSchema. The LLM output is still parsed as JSON but the prompt strongly constrains what types are produced.

Value parameters

llmClient

The LLM client to use for extraction

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def extract(text: String, schema: ExtractionSchema): Result[Graph]

Extracts entities and relationships from the given text, guided by the schema.

Extracts entities and relationships from the given text, guided by the schema.

Value parameters

schema

The extraction schema defining expected entity/relationship types

text

The text to analyze

Attributes

Returns

A Graph containing the extracted nodes and edges