Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt

Use this file to discover all available pages before exploring further.

ConfigKey

Metadata for a configuration key. Defines a single configuration option with its properties, validation rules, and relationship to environment variables. Used by the ConfigurationMeta metaclass to enable dynamic attribute access. Arguments
  • name (str): The attribute name used in the Configuration class (e.g., “galileo_api_key”).
  • env_var (str): The corresponding environment variable name (e.g., “GALILEO_API_KEY”).
  • description (str): Human-readable description of the configuration key’s purpose.
  • required (bool): Whether this key must be set for the configuration to be considered complete. Default: False.
  • sensitive (bool): Whether this key contains sensitive information (e.g., API keys, passwords). Sensitive values are masked in get_configuration() output. Default: False.
  • default (Any): The default value if no explicit value or environment variable is set. Default: None.
  • value_type (type): The expected Python type for this configuration value. Default: str.
  • parser (Optional[Callable[[str], Any]]): Optional function to convert string values from environment variables to the appropriate type. Default: None (no conversion).

ConfigurationMeta

Metaclass for dynamic attribute handling based on CONFIGURATION_KEYS. This metaclass enables the Configuration class to provide dynamic attribute access with automatic resolution from multiple sources. When accessing a configuration attribute (e.g., Configuration.galileo_api_key), the metaclass:
  1. Checks if the attribute is in _CONFIGURATION_KEYS
  2. Resolves the value from: explicit value → environment variable → .env file → default
  3. Applies type conversion and validation if a parser is defined
  4. Returns the resolved value
When setting a configuration attribute (e.g., Configuration.galileo_api_key = "key"), the metaclass:
  1. Stores the value internally (with underscore prefix: _galileo_api_key)
  2. Automatically updates the corresponding environment variable
  3. Ensures compatibility with libraries that read from os.environ
This pattern provides:
  • Extensibility: New configuration keys can be added to _CONFIGURATION_KEYS
  • Consistency: All configuration uses the same resolution pattern
  • Compatibility: Environment variables are kept in sync for third-party libraries
  • Transparency: Configuration sources are clearly prioritized
Reference: https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access

Configuration

Single source of truth for SDK configuration. This class uses a metaclass pattern to provide dynamic attribute access to configuration keys defined in _CONFIGURATION_KEYS. Each configuration key can be accessed as a class attribute, with values resolved in the following priority order:
  1. Explicitly set value (via Configuration.key = value)
  2. Environment variable (e.g., GALILEO_API_KEY)
  3. .env file (loaded automatically on first access)
  4. Default value (defined in the key configuration)
The metaclass automatically:
  • Syncs attribute assignments to environment variables
  • Loads .env files on first configuration access
  • Provides type conversion and validation via parsers
Arguments
  • Configuration attributes are dynamically provided based on _CONFIGURATION_KEYS: galileo_api_key (str): API key for Galileo authentication (sensitive) console_url (str): URL of the Galileo console openai_api_key (str): OpenAI API key for SDK interoperability (sensitive) default_project_name (str): Default project name default_project_id (str): Default project ID default_logstream_name (str): Default log stream name default_logstream_id (str): Default log stream ID logging_disabled (bool): Disable all telemetry logging to Galileo log_level (str): Python logging level for SDK console output
Examples Reading configuration values:
# Access via class attribute (reads from env vars, .env, or defaults)
api_key = Configuration.galileo_api_key
url = Configuration.console_url
Setting configuration values:
# Set explicitly (also updates environment variables)
Configuration.galileo_api_key = "your-api-key"
Configuration.console_url = "https://console.galileo.ai"
Checking and connecting:
# Check if required configuration is present
if Configuration.is_configured():
    Configuration.connect()
Getting all configuration:
# Get all configuration values (sensitive values are masked)
config = Configuration.get_configuration()
print(config["galileo_api_key"])  # Output: "***"
print(config["console_url"])       # Output: actual URL
Resetting configuration:
# Clear all configuration values and environment variables
Configuration.reset()
Configuring console logging:
# Enable console logging for debugging
Configuration.enable_console_logging()  # INFO level by default
Configuration.enable_console_logging("DEBUG")  # Verbose output

# Disable console logging
Configuration.disable_console_logging()
Notes
  • The Configuration class should not be instantiated; use it as a static class
  • Direct attribute access (e.g., Configuration.galileo_api_key) is the recommended pattern
  • The get_configuration() method masks sensitive values for safe display/logging
  • Setting an attribute automatically updates the corresponding environment variable
  • This design maintains compatibility with third-party libraries expecting env vars

connect

def connect(cls) -> None
Validate configuration and connect to Galileo.

disable_console_logging

def disable_console_logging(cls) -> None
Disable console logging for SDK output. This restores the SDK to its default silent behavior where no log messages are printed to the console. Examples
Configuration.disable_console_logging()

enable_console_logging

def enable_console_logging(cls, level: str | None=None) -> None
Enable console logging for SDK output. This is useful for debugging and interactive use (REPL, Jupyter, etc.) to see SDK progress and diagnostic information. Arguments
  • level (Optional[str]): Logging level as string: “DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”. If not provided, uses Configuration.log_level or defaults to “INFO”.
Examples
# Enable with default INFO level
Configuration.enable_console_logging()

# Enable with DEBUG level for verbose output
Configuration.enable_console_logging("DEBUG")

# Or set via configuration and enable
Configuration.log_level = "DEBUG"
Configuration.enable_console_logging()

get_configuration

def get_configuration(cls) -> dict[str, Any]
Get all configuration values (sensitive values are masked).

is_configured

def is_configured(cls) -> bool
Check if all required configuration keys are set.

reset

def reset(cls) -> None
Reset all configuration values and clear environment variables.

parse_log_level

def parse_log_level(value: str) -> str
Parse and validate a log level string; returns uppercase level name.