Skip to content

Configuration

Purpose

This page documents the Jeni configuration module.

Responsibilities

The configuration module centralizes environment-variable helpers, API key defaults, local paths, logging configuration, model lists, application modes, UI labels, help text, regular-expression patterns, database paths, and branding assets.

API Reference

config

Configuration settings for the Jeni Streamlit application.

Purpose

Defines application constants, runtime defaults, model option lists, filesystem paths, environment-variable readers, Streamlit help text, prompt patterns, and UI configuration used by the Jeni application and Gemini provider wrappers.

The module is intentionally import-safe for documentation generation. It should expose constants and small configuration helpers only. Streamlit runtime behavior belongs in app.py and provider behavior belongs in gemini.py.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, subject to inclusion of the copyright notice and permission notice in substantial portions of the software.

Contact

Terry Eppler, terryeppler@gmail.com or eppler.terry@epa.gov.

throw_if

Validate that a required value is present.

Purpose

Provides a compact guard for required arguments and configuration values. A value is considered invalid when it evaluates to false in Python.

Parameters:

Name Type Description Default
name str

Name of the argument or configuration value being validated.

required
value object

Value to validate.

required

Raises:

Type Description
ValueError

Raised when value is falsy.

get_bool

Read a Boolean environment variable.

Purpose

Converts environment-variable text into a deterministic Boolean value. Missing variables return the caller-provided default. Values of 1, true, yes, y, and on are treated as True; all other defined values are treated as False.

Parameters:

Name Type Description Default
name str

Environment variable name.

required
default bool

Default value used when the environment variable is not defined.

False

Returns:

Name Type Description
bool bool

Parsed Boolean value, or default when the variable is missing or parsing

bool

fails.

get_int

Read an integer environment variable.

Purpose

Parses an optional environment variable as an integer while preserving a safe default when the variable is missing, empty, or invalid.

Parameters:

Name Type Description Default
name str

Environment variable name.

required
default int

Default integer value used when parsing is not possible.

required

Returns:

Name Type Description
int int

Parsed integer value, or default when parsing fails.

get_float

Read a floating-point environment variable.

Purpose

Parses an optional environment variable as a float while preserving a safe default when the variable is missing, empty, or invalid.

Parameters:

Name Type Description Default
name str

Environment variable name.

required
default float

Default floating-point value used when parsing is not possible.

required

Returns:

Name Type Description
float float

Parsed floating-point value, or default when parsing fails.

get_path

Read a path environment variable.

Purpose

Resolves optional filesystem configuration from the environment. Missing variables return the resolved default path. Invalid values return the resolved default path rather than interrupting module import.

Parameters:

Name Type Description Default
name str

Environment variable name.

required
default Path

Default path used when the environment variable is not defined.

required

Returns:

Name Type Description
Path Path

Resolved path value, or the resolved default path.

get_text

Read a text environment variable.

Purpose

Returns an environment variable as text while preserving the supplied default when the variable is missing or empty.

Parameters:

Name Type Description Default
name str

Environment variable name.

required
default str

Default text value.

required

Returns:

Name Type Description
str str

Environment value, or default when the variable is missing or empty.