Skip to main content
A program is given one file, ladygraph.yaml. It holds the settings and names two data files that sit next to it. This page shows how to write your own, section by section. The minimal file below is tested: tests/test_project_paths.py loads it.

The files

The example files prompt.example.yaml, extractor.example.yaml, entity_kinds.example.yaml and glossary_builder.example.yaml are examples of a section of ladygraph.yaml, not separate files to load.
Paths. A relative path in ladygraph.yaml is relative to the file’s own folder, not to where you start the program. This holds for ontology:, glossary:, sources: entries, and the model and checkpoint paths in extractor:. A key that names a missing file is an error that says which key and where it looked.
Which setting wins. When a setting appears in several places, the order is: arguments passed in code, then LADYGRAPH_EXTRACTOR (for extractor.kind only), then the file, then the defaults.

What a sufficient folder looks like

docs/example_project/ in the repository is a real folder you can copy. tests/test_project_paths.py loads it, so it stays correct.
  • Required to index: ladygraph.yaml, ontology.yaml, and a source (here notes/).
  • Optional: glossary.yaml (translation only) and models/ (local models only).
  • Not in the folder: keys, which are environment variables, and the index store, wherever your program points it.
  • No model files? Use extractor.llm with backend: litellm and delete the ner: section. The folder is then just the four files and notes/.

A minimal file

Create a folder with these files. notes/ holds your markdown.
ladygraph.yaml
ontology.yaml
Without an extractor.llm: section, or an llm= argument in code, build_extractor stops with “no model”. A file that only loads is not yet a file that runs.
Check that it loads, from any folder:

The sections

Each section is read on its own from the same file. prompt: and extractor: reject a key they do not know, so a typo is an error and not a setting that silently does nothing.
Keys such as scope, store, embedder and timezone. The demo’s ladygraph.yaml has them, but the demo script reads them, not a loader in the package. Writing them does nothing in your own program unless your program reads them. The same holds for serve_min_trust, which docs/INTERFACE.md shows. The source search found no reader of these keys in the package.

The data files

ontology.yaml

types: maps a type name to a description. relations: maps a relation name to a description, from and to (lists of types, where an empty list means any), and optionally these keys: Every type a tagger label maps to must exist here, or the extractor stops with an error that names it. The core loader reads this format (Ontology.load). The demo’s mined ontology has another shape and goes through its own converter. Lesson 1 shows the checks on a small ontology: an allowed relation, a relation from the wrong type, a relation that needs a human actor, and a relation the ontology does not declare. An undeclared relation is kept as an untyped link.

glossary.yaml

Needed only when you translate.
vi is a historical key name. It lists the source-language forms of a term, whatever the language.

Secrets

Never put a key in a YAML file. Put the name of an environment variable (api_key_env, gateway.api_key_env) and set the variable in the shell. The builder refuses to print or write key values.

When it does not work