yr.llm

The configured LLM atlas, loaded lazily on first access.

Use print(yr.llm) to inspect the models available in the active profile. The configured default is available through default(). Named models may be selected using their dotted configuration ID or, for interactive use, through attribute access.

Calling a model entry creates a context manager. Entering that context temporarily selects the model while retaining the app's shared conversation workspace. Use none() only for apps that do not call model-backed operations such as response, gen, select, condition, or Struct.fill.

Examples

Inspect the configured models and select model contexts:

python
import yera as yr

print(yr.llm)

@yr.app
def compare_capitals(country: str) -> tuple[str, str]:
    with yr.llm.default():
        default_answer = yr.response(
            f"What is the capital of {country}?"
        )

    with yr.llm["provider.model"]():
        named_answer = yr.response(
            f"Give one fact about the capital of {country}."
        )

    return default_answer, named_answer

@yr.app(llm=yr.llm.none())
def local_greeting(name: str) -> str:
    return f"Hello, {name}!"

Raises

ProfileConfigError

On first access, if no profiles are configured. Run yera setup.