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

class BaseAtlas — A navigable tree of model context factories.

BaseAtlas

Inherits: PathTree[TFactory], ABC, Generic[TContext, TFactory]
Subclasses: LLMAtlas

A 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

python
print(atlas)
┌─[model-type]
├─ Default: provider1.model2
│
├── provider1/
│   ├── model1
│   └── model2
└── provider2/
    └── model1

Methods

none — Return a no-op model context for this atlas type.
__yera_tree__ — Return this atlas as tree-selector-compatible options.
__str__ — Render the atlas as a tree, showing children and the default.
__repr__ — Return a tree view of the atlas as a string.
__len__ — Number of children on this node.

BaseAtlas.none

none() → TContext

Return a no-op model context for this atlas type.

Returns

type: TContext

A model context representing the absence of a model.

BaseAtlas.__yera_tree__

__yera_tree__() → TreeSelectorMapping

Return this atlas as tree-selector-compatible options.

Returns

type: TreeSelectorMapping

Nested atlas labels whose leaves contain their original configured IDs.

BaseAtlas.__str__

__str__() → str

Render 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__() → str

Return a tree view of the atlas as a string.

BaseAtlas.__len__

__len__() → int

Number of children on this node.