Fix configs validation #66

Merged
Berack96 merged 4 commits from fix-configs-validation into main 2025-10-30 15:47:07 +01:00
Showing only changes of commit 20f97f6e43 - Show all commits

View File

@@ -149,6 +149,26 @@ class AgentsConfigs(BaseModel):
query_analyzer_model: str = "gemini-2.0-flash" query_analyzer_model: str = "gemini-2.0-flash"
copilot-pull-request-reviewer[bot] commented 2025-10-29 23:09:33 +01:00 (Migrated from github.com)
Review

The docstring parameters don't match the actual method signature. The method accepts a single configs: AppConfig parameter, not separate models and strategies parameters. Update the Args section to reflect the actual parameter.

            configs: AppConfig instance containing all available models and strategies.
The docstring parameters don't match the actual method signature. The method accepts a single `configs: AppConfig` parameter, not separate `models` and `strategies` parameters. Update the Args section to reflect the actual parameter. ```suggestion configs: AppConfig instance containing all available models and strategies. ```
report_generation_model: str = "gemini-2.0-flash" report_generation_model: str = "gemini-2.0-flash"
def validate_defaults(self, configs: 'AppConfig') -> None:
"""
Validate that the default models and strategy exist in the provided configurations.
Args:
models: ModelsConfig instance containing all available models.
strategies: list of Strategy instances containing all available strategies.
"""
try:
configs.get_strategy_by_name(self.strategy)
except ValueError as e:
log.error(f"Default strategy '{self.strategy}' not found in configurations.")
raise e
for model_name in [self.team_model, self.team_leader_model, self.query_analyzer_model, self.report_generation_model]:
try:
configs.get_model_by_name(model_name)
except ValueError as e:
log.error(f"Default agent model '{model_name}' not found in configurations.")
raise e
class AppConfig(BaseModel): class AppConfig(BaseModel):
port: int = 8000 port: int = 8000
gradio_share: bool = False gradio_share: bool = False
@@ -190,6 +210,7 @@ class AppConfig(BaseModel):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.set_logging_level() self.set_logging_level()
self.models.validate_models() self.models.validate_models()
self.agents.validate_defaults(self)
self._initialized = True self._initialized = True
def get_model_by_name(self, name: str) -> AppModel: def get_model_by_name(self, name: str) -> AppModel: