Problem/Motivation
Looking at the code we basically allow all the chat models to be allowed with tools and structured content. This is not true, see https://platform.openai.com/docs/models/gpt-3.5-turbo for instance.
We need to add the check to exclude these models.
Steps to reproduce
Install the AI module and the AI provider.
Setup OpenAI
Visit /admin/config/ai/settings and check the models for Chat with Tools and Chat with Structured Content.
You can pick 3.5 there.
Proposed resolution
Check which models actually supports this. Anything after 4.1 does it. Make sure to verify reasoning models like o1 or o3.
Add so that only these models are pickable with those capabilities.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3572299-chat-working.png | 202.51 KB | danrod |
| #7 | 3572299-after2.png | 208.82 KB | danrod |
| #7 | 3572299-after1.png | 203.25 KB | danrod |
| #7 | 3572299-before1.png | 158.24 KB | danrod |
Issue fork ai_provider_openai-3572299
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
arianraeesi commentedComment #5
nickolajAdded capability checks in `getModels()` for `ChatTools`, `ChatStructuredResponse`, and `ChatCombinedToolsAndStructuredResponse`. These filter models to GPT-4.1+, GPT-4o, GPT-4-turbo, GPT-5, and o-series (o1, o3, o4), preventing older models like GPT-3.5 from being offered for these features.
Comment #6
danrodComment #7
danrodI tested this and initially, works as expected.
Chat models before the change (you can pick the old 3.5 models here):
Chat models after the change:
You won't be able to pick the old ChatGPT models (3.5).
But if you go to Chat Generation Explorer
/admin/config/ai/explorers/chat_generator, you can still pick the old models, that needs to be addresed:The chatbox after picking a new model seems to be working though:
Comment #8
danrodComment #9
marcus_johansson commentedActually the API Explorer is generic and should show any chat model available - so as long it is not showing text to image models or something else, its working as it should be.
The restricted chat listings are for agents, automators or other things that might request it.
Comment #10
danrodHi @marcus_johansson , thanks for the clarification, as discussed in Slack, I'll move it to RTBC
Comment #11
danrodComment #15
a.dmitriiev commentedMerged to 1.2.x and backported to 1.1.x
Comment #17
arianraeesi commented