Skip to content

prompts

The Jinja prompt templates that drive the LLM chains. Source: src/laife/prompts/. This package holds template files only, no Python; the chains that use them live in the llm package and the entities package.

Layout

Templates are grouped by the chain that uses them, one folder per chain, with one file per version:

How a template is selected

A chain is configured with a PromptLoaderConfig that names the base folder and the chain: the base folder is prompts_fol from the paths, which resolves to this package, and the prompt name is the chain folder, such as player_brain. The loader reads the templates from that folder; keeping versions side by side as v1.jinja, v2.jinja lets a prompt evolve without deleting the previous wording. See the construction sites in entities/player.py and entities/world_runner.py.

Template variables

Each template fills the variables the chain provides, for example mission, history, observation, player_state, and inventory for the brain. Those variable names are not free-form: they are the fields of the chain's input model, and the structured chain derives the required set from those fields, so a template that references an unknown variable is caught. See the LLM chains guide for that input-model-to-prompt contract.