SchemaGuidedExtractor
org.llm4s.knowledgegraph.extraction.SchemaGuidedExtractor
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
- Example
-
val schema = ExtractionSchema.simple( entityTypes = Seq("Person", "Organization"), relationshipTypes = Seq("WORKS_FOR", "MANAGES") ) val extractor = new SchemaGuidedExtractor(llmClient) val result = extractor.extract("Alice manages Bob at Acme Corp.", schema) - Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article