Utils
Auto mode configuration#
genai_monitor.utils.auto_mode_configuration.load_config
#
load_config(
db_url: str,
default_settings: Dict[
str, dict[str, str]
] = DEFAULT_SETTINGS,
) -> Config
Load configuration from database.
PARAMETER | DESCRIPTION |
---|---|
db_url
|
The database URL.
TYPE:
|
default_settings
|
The default settings to use if no configuration is found.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Config
|
The configuration as a dictionary. |
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If the configuration could not be loaded. |
Source code in src/genai_monitor/utils/auto_mode_configuration.py
Data hashing#
genai_monitor.utils.model_hashing.default_model_hashing_function
#
Default model hashing function.
PARAMETER | DESCRIPTION |
---|---|
model
|
The model to hash.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str | Literal[UNKNOWN_MODEL_HASH]
|
str | Literal[UNKNOWN_MODEL_HASH]: The hash of the model. |
Source code in src/genai_monitor/utils/model_hashing.py
User registration#
genai_monitor.utils.user_registration.register_user
#
register_user(
db_manager: DBManager, runtime_manager: RuntimeManager
)
Register a new user if not already registered.
PARAMETER | DESCRIPTION |
---|---|
db_manager
|
The database manager.
TYPE:
|
runtime_manager
|
The runtime manager.
TYPE:
|