Skip to content

Commit

Permalink
Config: Add aliases for logging config
Browse files Browse the repository at this point in the history
Config.yml and args take in two different values.

Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Sep 15, 2024
1 parent 6f28cfe commit d013729
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions common/config_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, ConfigDict, Field
from pydantic import AliasChoices, BaseModel, ConfigDict, Field
from typing import List, Literal, Optional, Union
from pathlib import Path

Expand Down Expand Up @@ -47,21 +47,31 @@ class NetworkConfig(BaseModel):
description=("Decide whether to send error tracebacks over the API"),
)
api_servers: Optional[List[Literal["OAI", "Kobold"]]] = Field(
[
"OAI",
],
default_factory=list,
description=("API servers to enable. Options: (OAI, Kobold)"),
)


# TODO: Migrate config.yml to have the log_ prefix
# This is a breaking change.
class LoggingConfig(BaseModel):
"""Model for logging configuration."""

log_prompt: Optional[bool] = Field(False, description=("Enable prompt logging"))
log_prompt: Optional[bool] = Field(
False,
description=("Enable prompt logging"),
validation_alias=AliasChoices("log_prompt", "prompt"),
)
log_generation_params: Optional[bool] = Field(
False, description=("Enable generation parameter logging")
False,
description=("Enable generation parameter logging"),
validation_alias=AliasChoices("log_generation_params", "generation_params"),
)
log_requests: Optional[bool] = Field(
False,
description=("Enable request logging"),
validation_alias=AliasChoices("log_requests", "requests"),
)
log_requests: Optional[bool] = Field(False, description=("Enable request logging"))


class ModelConfig(BaseModel):
Expand Down

0 comments on commit d013729

Please sign in to comment.