KnowledgeGraphGenerator

org.llm4s.knowledgegraph.extraction.KnowledgeGraphGenerator
class KnowledgeGraphGenerator(llmClient: LLMClient, graphStore: GraphStore)

Generates a Knowledge Graph from unstructured text using an LLM and writes it to a GraphStore.

Value parameters

graphStore

The graph store to write extracted entities and relationships to

llmClient

The LLM client to use for extraction

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(llmClient: LLMClient)

Backward-compatible constructor that uses in-memory graph storage.

Backward-compatible constructor that uses in-memory graph storage.

Attributes

Concrete methods

def extract(text: String, entityTypes: List[String], relationTypes: List[String]): Result[Graph]

Extracts entities and relationships from the given text and writes them to the configured GraphStore.

Extracts entities and relationships from the given text and writes them to the configured GraphStore.

Value parameters

entityTypes

Optional list of entity types to focus on (e.g., "Person", "Organization")

relationTypes

Optional list of relationship types to look for

text

The text to analyze

Attributes

Returns

Right(extractedGraph) on success, Left(ProcessingError) on failure