This module defines the RootConfig
model, which is a wrapper around the main configuration
model OpenTicketAIConfig
. The purpose of this wrapper is to facilitate the generation of
a JSON schema that describes the entire configuration structure.
When this module is run as a script, it will:
RootConfig
model.config.schema.json
in the project's root directory.The generated schema file can be used for validating configuration files or for providing configuration autocompletion and documentation in editors.
From: src.ce.core.util.create_json_config_schema
This class serves as a container for the main configuration model of the OpenTicketAI system. It is designed to be used for generating JSON schema representations of the configuration.
`open_ticket_ai`
`OpenTicketAIConfig`The main configuration object containing all settings and parameters for the OpenTicketAI system.
This module provides helper functions for common path operations, particularly for locating important directories in the project structure.
This function traverses upwards from the current file's directory to locate the root directory of the project identified by the given name.
project_name
The name of the project root directory to find. Defaults to 'open_ticket_ai'.
The absolute path to the project root directory.
FileNotFoundError
If the project root directory cannot be found in any parent directories.
This module provides functionality to display Pydantic configuration models in a
nicely formatted and syntax highlighted way using the rich
library. It converts
Pydantic models to YAML format and applies syntax highlighting for improved readability.
Features:
BaseModel
instances to dictionariesrich
rich
.This function converts a Pydantic BaseModel
to a dictionary, serializes it to YAML,
and prints it to the console using rich
's syntax highlighting. The output is formatted
with YAML syntax highlighting for improved readability.
The process involves:
1. Converting the Pydantic model to a dictionary using model_dump()
2. Serializing the dictionary to a YAML string
3. Creating a rich Syntax
object with YAML highlighting
4. Printing the highlighted YAML to the console
Note that this function bypasses standard logging and outputs directly to the console
using rich
's printing capabilities for optimal formatting.
config
BaseModelThe Pydantic model configuration to display.
console
ConsoleThe rich console instance for output rendering.
TypeError
If config
is not a Pydantic BaseModel instance.
yaml.YAMLError
If YAML serialization fails due to invalid data.