Skip to content

Config

alloy.config

_config_from_env

_config_from_env()

Build a Config from process environment variables (optional).

Supported variables
  • ALLOY_MODEL (str)
  • ALLOY_TEMPERATURE (float)
  • ALLOY_MAX_TOKENS (int)
  • ALLOY_SYSTEM or ALLOY_DEFAULT_SYSTEM (str)
  • ALLOY_RETRY (int)
  • ALLOY_EXTRA_JSON (JSON object for provider-specific extras)

configure

configure(**kwargs)

Set global defaults for Alloy execution.

Example

configure(model="gpt-4", temperature=0.7)

use_config

use_config(temp_config)

Context manager to apply a config within a scope.

get_config

get_config(overrides=None)

Return the effective config (global -> context -> overrides).