extractor: section, the first version, llm_okf, is built.
What stays the same in every kind: a concept’s evidence is a quote found in the passage as written, placement and relation checks are shared code, and the result goes through the same validation. Only the step that finds concepts differs.
Choose a model: extractor.llm
Every kind needs a model, because every kind places each concept in a context.
The defaults, from
LlmConfig: temperature 0.0 (the extractor must be reproducible), max_output_tokens 8192, timeout_s 120 per request, attempts 3, backoff_s 1.0 (doubling after each failed attempt), and repair_attempts 1.
The ner and translate_ner kinds
ner and translate_ner also need an ner: section with the GLiNER model and the labels to ask for. This section is tested:
If the tokenizer folder lacks those two files, loading falls back to the
gliner package, which is slower and needs torch. encoder_kind: tokenizers makes that an error instead. Load time is about 8 s on the GPU, mostly compiling the model. There is no torch in the default path.
Relations
A tagger names no relation, so one model call per document asks for them. It uses thellm_okf schema and checks: the quote must be in the text, and the types and cardinality must fit. What fails is dropped.
- The model is
extractor.relations_llmif set, otherwiseextractor.llm. relations: falseturns the call off.- The call is skipped when fewer than two concepts were found, or when the ontology has no relation a machine may create.
Measured once with the E2B model on 3 real chunks: the call ran and E2B proposed none. A stronger
relations_llm is the first thing to try.Switch and build
- Switch one run without editing the file with
LADYGRAPH_EXTRACTOR=ner. A wrong value is an error, not a silent default. The variable cannot add settings the file lacks:nerwithout anextractor.ner:section fails with a message. - Build it with
build_extractor("ladygraph.yaml", embedder=...). It reads this section and theprompt:section. Argumentsllm=,tagger=andembedder=win over the file. A local model builds lazily, so nothing loads until the first call.
Compare before you switch
compare_extractors(doc, ontology, registry, a, b) runs two extractors on one document. It returns what only a made, what only b made, what both made, and an agreement score. It writes nothing.
Lesson 9 shows all three kinds side by side on one document and compares them.