Settings¶
ChatCompletionSettings
¶
Bases: BaseSettings
Represents settings for a chat completion request.
This class encapsulates the configuration parameters needed to interact with a chat completion service, such as OpenAI's Chat Completions API. It provides attributes for specifying the model, temperature, timeout, base URL, and API key.
Source code in repo_agent/settings.py
convert_base_url_to_str(openai_base_url)
classmethod
¶
Ensures the OpenAI base URL is handled as a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
openai_base_url
|
HttpUrl
|
The base URL for OpenAI. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The string representation of the base URL. |
Source code in repo_agent/settings.py
LogLevel
¶
Bases: StrEnum
Represents different log levels for categorizing log messages.
This class provides a set of constants representing standard log levels, allowing for easy and consistent categorization of log output.
Source code in repo_agent/settings.py
ProjectSettings
¶
Bases: BaseSettings
Project settings class to manage configuration for repository analysis.
This class encapsulates all configurable parameters related to the project, such as repository details, documentation generation preferences, and logging options.
Source code in repo_agent/settings.py
set_log_level(v)
classmethod
¶
Converts a string to a LogLevel
enum member, raising an error for invalid inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
str
|
The log level string to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
LogLevel |
LogLevel
|
The LogLevel enum member corresponding to the input string. |
Raises:
Type | Description |
---|---|
ValueError
|
If the provided log level string is invalid. |
Source code in repo_agent/settings.py
validate_language_code(v)
classmethod
¶
Ensures the provided input represents a recognized language, returning its standardized name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
str
|
The language code or name to validate. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The validated language name. |
Raises:
Type | Description |
---|---|
ValueError
|
If the input is not a valid ISO 639 code or language name. |
Source code in repo_agent/settings.py
Setting
¶
Bases: BaseSettings
Represents a configurable setting with a name, value, and description.
This class is designed to hold configuration parameters for an application or system. It allows storing settings with associated descriptions for better maintainability and understanding.
Source code in repo_agent/settings.py
SettingsManager
¶
SettingsManager manages and provides access to application settings.
This class acts as a central repository for configuration parameters, ensuring consistent access throughout the application. It utilizes a singleton pattern to maintain a single instance of the settings.
Class Attributes: - _setting_instance
Class Methods: - get_setting:
Source code in repo_agent/settings.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
get_setting()
classmethod
¶
Provides access to the application’s configuration. Creates a new configuration object if one doesn't already exist, ensuring consistent settings throughout the application lifecycle.
This method ensures that only one instance of the Setting class is created
and returns it. If an instance doesn't exist, it creates one first.
Parameters:
cls - The class itself.
Returns:
Setting: The singleton instance of the Setting class.
Source code in repo_agent/settings.py
initialize_with_params(target_repo, markdown_docs_name, hierarchy_name, ignore_list, language, max_thread_count, log_level, model, temperature, request_timeout, openai_base_url, parse_references=True)
classmethod
¶
Configures the application with project-specific and OpenAI connection details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_repo
|
Path
|
The path to the target repository. |
required |
markdown_docs_name
|
str
|
The name of the markdown documentation file. |
required |
hierarchy_name
|
str
|
The name used for hierarchy representation. |
required |
ignore_list
|
list[str]
|
A list of files or directories to ignore during processing. |
required |
language
|
str
|
The programming language of the codebase. |
required |
max_thread_count
|
int
|
The maximum number of threads to use for parallel processing. |
required |
log_level
|
str
|
The logging level to be used. |
required |
model
|
str
|
The name of the OpenAI model to use. |
required |
temperature
|
float
|
The temperature setting for the OpenAI model. |
required |
request_timeout
|
int
|
The request timeout in seconds for OpenAI API calls. |
required |
openai_base_url
|
str
|
The base URL for the OpenAI API. |
required |
parse_references
|
bool
|
Whether to parse references within the documentation. |
True
|
Returns:
Type | Description |
---|---|
None |