language_models: Add vision support for OpenAI gpt-5, gpt-5-mini, and gpt-5-nano models (#36047)

## Summary
Enable image processing capabilities for GPT-5 series models by updating
the `supports_images()` method.

## Changes
- Add vision support for `gpt-5`, `gpt-5-mini`, and `gpt-5-nano` models
- Update `supports_images()` method in
`crates/language_models/src/provider/open_ai.rs`

## Models with Vision Support (after this PR)
- gpt-4o
- gpt-4o-mini
- gpt-4.1
- gpt-4.1-mini
- gpt-4.1-nano
- gpt-5 (new)
- gpt-5-mini (new)
- gpt-5-nano (new)
- o1
- o3
- o4-mini

This brings GPT-5 vision capabilities in line with other OpenAI models
that support image processing.

Release Notes:

- Added vision support for OpenAI models
This commit is contained in:
Rishabh Bothra 2025-08-12 21:34:51 +05:30 committed by GitHub
parent d8fc53608e
commit 9de04ce215
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -301,7 +301,25 @@ impl LanguageModel for OpenAiLanguageModel {
}
fn supports_images(&self) -> bool {
false
use open_ai::Model;
match &self.model {
Model::FourOmni
| Model::FourOmniMini
| Model::FourPointOne
| Model::FourPointOneMini
| Model::FourPointOneNano
| Model::Five
| Model::FiveMini
| Model::FiveNano
| Model::O1
| Model::O3
| Model::O4Mini => true,
Model::ThreePointFiveTurbo
| Model::Four
| Model::FourTurbo
| Model::O3Mini
| Model::Custom { .. } => false,
}
}
fn supports_tool_choice(&self, choice: LanguageModelToolChoice) -> bool {