yera.models.atlas.base
Navigable tree of model context factories.
Defines BaseAtlas, the abstract
base for model atlases. Atlases are built from the active Yera profile
at config-load time and made available to user code through proxy
singletons such as llm.
They are to be used for exploring available models and then setting them as the active context to be used within apps.
Symbols
BaseAtlas
PathTree[TFactory], ABC, Generic[TContext, TFactory]LLMAtlasA navigable tree of model context factories.
Each leaf is a callable that returns a model context, ready for use
in a with block. Each interior node is another atlas, holding
further sub-atlases and leaves.
Yera exposes one atlas per type of model: LLMs, TTS, STT, and so
on. Atlases are built from the active Yera profile and are not
constructed by user code directly; users access them through proxy
singletons such as llm.
Two access styles are supported:
- Attribute access, preferred for interactive use (Jupyter,
REPL):
atlas.openai.gpt_4o. Dashes in configured model names become underscores in attribute form ("gpt-4o"→gpt_4o). - Dot-path indexing, preferred for scripts:
atlas["openai.gpt-4o"]. The dashed form from configuration is accepted here directly.
Atlases render as a tree when printed, so they are self-describing in interactive sessions:
Examples
print(atlas)
┌─[model-type]
├─ Default: provider1.model2
│
├── provider1/
│ ├── model1
│ └── model2
└── provider2/
└── model1Methods
BaseAtlas.none
none() → TContextReturn a no-op model context for this atlas type.
Returns
A model context representing the absence of a model.
BaseAtlas.__yera_tree__
__yera_tree__() → TreeSelectorMappingReturn this atlas as tree-selector-compatible options.
Returns
Nested atlas labels whose leaves contain their original configured IDs.
BaseAtlas.__str__
__str__() → strRender the atlas as a tree, showing children and the default.
The same rendering is used for __repr__, so atlases display
informatively in REPLs and notebooks.
BaseAtlas.__repr__
__repr__() → strReturn a tree view of the atlas as a string.
BaseAtlas.__len__
__len__() → intNumber of children on this node.