Configuration
llm_expose.config.models
¶
Configuration models for llm-expose using Pydantic.
DiscordClientConfig
¶
Bases: BaseModel
Configuration for the Discord client adapter.
Source code in llm_expose/config/models.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
normalize_mcp_servers(values)
classmethod
¶
Normalize attached MCP server names preserving order and uniqueness.
Source code in llm_expose/config/models.py
250 251 252 253 254 255 256 257 258 259 260 261 262 | |
normalize_model_name(value)
classmethod
¶
Normalize optional model name by trimming outer whitespace.
Source code in llm_expose/config/models.py
273 274 275 276 277 278 279 280 | |
token_must_not_be_empty(v)
classmethod
¶
Ensure bot token is not blank.
Source code in llm_expose/config/models.py
242 243 244 245 246 247 248 | |
validate_system_prompt_path(value)
classmethod
¶
Validate system prompt path by trimming outer whitespace.
Source code in llm_expose/config/models.py
264 265 266 267 268 269 270 271 | |
ExposureConfig
¶
Bases: BaseModel
Top-level configuration for a single LLM exposure.
Source code in llm_expose/config/models.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
name_must_not_be_empty(v)
classmethod
¶
Ensure name is a non-empty, cross-platform filesystem-safe identifier.
The forbidden set covers characters that are invalid in file names on
Windows (/ \ : * ? " < > |) so configs remain portable across
operating systems.
Source code in llm_expose/config/models.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
normalize_channel_name(value)
classmethod
¶
Normalize optional channel namespace by trimming whitespace.
Source code in llm_expose/config/models.py
321 322 323 324 325 326 327 328 | |
MCPConfig
¶
Bases: BaseModel
Top-level MCP configuration persisted on disk.
Source code in llm_expose/config/models.py
183 184 185 186 187 | |
MCPServerConfig
¶
Bases: BaseModel
Configuration for a single MCP server integration.
Source code in llm_expose/config/models.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
command_must_not_be_empty_when_present(v)
classmethod
¶
Normalize optional command by trimming whitespace.
Source code in llm_expose/config/models.py
142 143 144 145 146 147 148 149 | |
server_name_must_not_be_empty(v)
classmethod
¶
Ensure server name is not blank.
Source code in llm_expose/config/models.py
134 135 136 137 138 139 140 | |
url_must_not_be_empty_when_present(v)
classmethod
¶
Normalize optional URL by trimming whitespace.
Source code in llm_expose/config/models.py
151 152 153 154 155 156 157 158 | |
MCPSettingsConfig
¶
Bases: BaseModel
Global MCP runtime settings shared by all exposures.
Source code in llm_expose/config/models.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
PairingsConfig
¶
Bases: BaseModel
Top-level pairing configuration persisted on disk.
Pair IDs are stored by channel config name so each configured channel can have an independent allowlist of sender/channel identifiers.
Source code in llm_expose/config/models.py
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 | |
normalize_pairs_by_channel(values)
classmethod
¶
Trim and deduplicate channel names and pair IDs.
Source code in llm_expose/config/models.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
ProviderConfig
¶
Bases: BaseModel
Configuration for an LLM provider.
Source code in llm_expose/config/models.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
must_not_be_empty(v)
classmethod
¶
Ensure required string fields are not blank.
Source code in llm_expose/config/models.py
33 34 35 36 37 38 39 | |
TelegramClientConfig
¶
Bases: BaseModel
Configuration for the Telegram client adapter.
Source code in llm_expose/config/models.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
normalize_mcp_servers(values)
classmethod
¶
Normalize attached MCP server names preserving order and uniqueness.
Source code in llm_expose/config/models.py
68 69 70 71 72 73 74 75 76 77 78 79 80 | |
normalize_model_name(value)
classmethod
¶
Normalize optional model name by trimming outer whitespace.
Source code in llm_expose/config/models.py
91 92 93 94 95 96 97 98 | |
token_must_not_be_empty(v)
classmethod
¶
Ensure bot token is not blank.
Source code in llm_expose/config/models.py
60 61 62 63 64 65 66 | |
validate_system_prompt_path(value)
classmethod
¶
Validate system prompt path by trimming outer whitespace.
Source code in llm_expose/config/models.py
82 83 84 85 86 87 88 89 | |
llm_expose.config.loader
¶
Configuration loading and saving utilities for llm-expose.
add_pair(channel_name, pair_id)
¶
Add a pair ID to a channel's pairing allowlist.
Source code in llm_expose/config/loader.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
delete_channel(name)
¶
Delete a saved channel config by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the channel config to delete. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no channel with the given name exists. |
Source code in llm_expose/config/loader.py
230 231 232 233 234 235 236 237 238 239 240 241 242 | |
delete_mcp_server(name)
¶
Delete a configured MCP server by name.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no MCP server with the given name exists. |
Source code in llm_expose/config/loader.py
307 308 309 310 311 312 313 314 315 316 317 318 | |
delete_model(name)
¶
Delete a saved model config by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the model config to delete. |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no model with the given name exists. |
Source code in llm_expose/config/loader.py
152 153 154 155 156 157 158 159 160 161 162 163 164 | |
delete_pair(channel_name, pair_id)
¶
Delete a pair ID from a channel's pairing allowlist.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the channel/pair entry does not exist. |
Source code in llm_expose/config/loader.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
get_base_dir()
¶
Return the base directory used to store all configs.
The directory is resolved from the LLM_EXPOSE_CONFIG_DIR environment
variable when set, otherwise defaults to ~/.llm-expose.
Source code in llm_expose/config/loader.py
61 62 63 64 65 66 67 68 69 70 | |
get_builtin_mcp_servers()
¶
Return builtin MCP server definitions available to all installs.
Source code in llm_expose/config/loader.py
25 26 27 28 29 30 31 32 | |
get_channels_dir()
¶
Return the directory used to store channel configs.
Source code in llm_expose/config/loader.py
78 79 80 | |
get_mcp_config_path()
¶
Return the file path used to store MCP server settings/config.
Source code in llm_expose/config/loader.py
83 84 85 | |
get_mcp_server(name)
¶
Return a single MCP server config by name.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no MCP server with the given name exists. |
Source code in llm_expose/config/loader.py
280 281 282 283 284 285 286 287 288 289 290 | |
get_models_dir()
¶
Return the directory used to store model configs.
Source code in llm_expose/config/loader.py
73 74 75 | |
get_pairs_config_path()
¶
Return the file path used to store channel pairing settings.
Source code in llm_expose/config/loader.py
88 89 90 | |
get_pairs_for_channel(channel_name)
¶
Return the pair IDs configured for a specific channel config name.
Source code in llm_expose/config/loader.py
378 379 380 381 382 383 384 385 | |
list_channels()
¶
Return names of all saved channel configs.
Returns:
| Type | Description |
|---|---|
list[str]
|
A sorted list of channel config names. |
Source code in llm_expose/config/loader.py
218 219 220 221 222 223 224 225 226 227 | |
list_mcp_servers()
¶
Return names of configured MCP servers.
Source code in llm_expose/config/loader.py
274 275 276 277 | |
list_models()
¶
Return names of all saved model configs.
Returns:
| Type | Description |
|---|---|
list[str]
|
A sorted list of model config names. |
Source code in llm_expose/config/loader.py
140 141 142 143 144 145 146 147 148 149 | |
list_pairs(channel_name=None)
¶
Return channel-scoped pair IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel_name
|
str | None
|
Optional channel name to filter by. |
None
|
Source code in llm_expose/config/loader.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
load_channel(name)
¶
Load a channel configuration from disk by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name used when the channel was saved. |
required |
Returns:
| Type | Description |
|---|---|
ClientConfig
|
The deserialized client config (routed via |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no channel with the given name exists. |
ValueError
|
If the YAML is malformed or validation fails. |
Source code in llm_expose/config/loader.py
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 | |
load_mcp_config()
¶
Load MCP configuration from disk.
Returns defaults when the config file does not exist yet.
Source code in llm_expose/config/loader.py
250 251 252 253 254 255 | |
load_mcp_settings()
¶
Return global MCP runtime settings.
Source code in llm_expose/config/loader.py
321 322 323 | |
load_model(name)
¶
Load a model configuration from disk by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name used when the model was saved. |
required |
Returns:
| Type | Description |
|---|---|
ProviderConfig
|
The deserialized :class: |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no model with the given name exists. |
ValueError
|
If the YAML is malformed or validation fails. |
Source code in llm_expose/config/loader.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
load_pairings_config()
¶
Load channel pairing configuration from disk.
Returns defaults when the config file does not exist yet.
Source code in llm_expose/config/loader.py
338 339 340 341 342 343 344 345 346 347 348 | |
save_channel(name, config)
¶
Persist a channel configuration to a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique name for this channel configuration. |
required |
config
|
TelegramClientConfig | DiscordClientConfig
|
The client config instance to save (Telegram or Discord). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
The |
Path
|
class: |
Source code in llm_expose/config/loader.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
save_mcp_config(config)
¶
Persist MCP configuration to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MCPConfig
|
Full MCP configuration object. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The path where the YAML file was written. |
Source code in llm_expose/config/loader.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
save_mcp_server(server)
¶
Create or update a single MCP server entry by name.
Source code in llm_expose/config/loader.py
293 294 295 296 297 298 299 300 301 302 303 304 | |
save_mcp_settings(settings)
¶
Persist only global MCP runtime settings.
Source code in llm_expose/config/loader.py
326 327 328 329 330 | |
save_model(name, config)
¶
Persist a model configuration to a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique name for this model configuration. |
required |
config
|
ProviderConfig
|
The :class: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
The |
Path
|
class: |
Source code in llm_expose/config/loader.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
save_pairings_config(config)
¶
Persist channel pairing configuration to disk.
Source code in llm_expose/config/loader.py
351 352 353 354 355 356 357 | |