mirror of
https://github.com/hwchase17/langchain.git
synced 2026-03-19 19:44:08 +00:00
Fixed a bug where GPT-5 temperature validation was case-sensitive, causing issues when users specified Azure deployment names or model names in uppercase (e.g., `"GPT-5-2025-01-01"`, `"GPT-5-NANO"`). The validation now correctly handles model names regardless of case. Changes made: - Updated `validate_temperature()` method in `BaseChatOpenAI` to perform case-insensitive model name comparisons - Updated `_get_encoding_model()` method to use case-insensitive checks for tiktoken encoder selection - Added comprehensive unit tests to verify case-insensitive behavior with various case combinations **Issue:** Fixes #34003 **Dependencies:** None **Test Coverage:** - All existing tests pass - New test `test_gpt_5_temperature_case_insensitive` covers uppercase, lowercase, and mixed-case model names - Tests verify both non-chat GPT-5 models (temperature removed) and chat models (temperature preserved) - Lint and format checks pass (`make lint`, `make format`) --------- Co-authored-by: Mason Daugherty <github@mdrxy.com>