Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds automatic temperature adjustment for GPT-5 models in the Slackbot settings. When a GPT-5 model is detected, the temperature is automatically set to 1.0.
- Imports
model_validatorfrom pydantic for model-level validation - Adds a validator that sets temperature to 1.0 for any model containing "gpt-5"
|
|
||
| @model_validator(mode="after") | ||
| def validate_temperature(self) -> "SlackbotSettings": | ||
| if "gpt-5" in self.model_name: |
There was a problem hiding this comment.
The validator is checking self.model_name which is a property that calls Variable.get(), but this validation occurs during model initialization when the Variable system may not be properly initialized yet. This could cause the validator to fail or behave unexpectedly.
| @model_validator(mode="after") | ||
| def validate_temperature(self) -> "SlackbotSettings": | ||
| if "gpt-5" in self.model_name: | ||
| self.temperature = 1.0 |
There was a problem hiding this comment.
Direct assignment to self.temperature in a model validator may not work as expected with Pydantic models. The temperature field should be validated and set through the proper Pydantic field validation mechanism or the validator should return a modified copy of the model.
| self.temperature = 1.0 | |
| return self.model_copy(update={"temperature": 1.0}) |
No description provided.