Utils
Auto mode configuration#
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#
    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#
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:
                       |