Skip to content

Conversation

@paulinevos
Copy link
Contributor

@paulinevos paulinevos commented Nov 14, 2025

Q A
Bug fix? no
New feature? yes
Docs? yes
Issues Fix #796
License MIT

This PR migrates OpenAI from chat completions (deprecated) to the Responses API. I tried to keep the scope small and just support everything already in place as seamlessly as possible. The Responses API does offer some more functionality that we should look into supporting (e.g. MCP tool calling, expanded reasoning functionality), but I found that OOS for this migration.

One thing to note it that the Responses API as of now lacks Audio capabilities ("coming soon", according to the docs), so that example is temporarily disabled and so is the Gpt audio capability for now.

Note: my PRs are best reviewed commit by commit

@carsonbot carsonbot changed the title Migrate OpenAI to Responses API Migrate OpenAI to Responses API Nov 14, 2025
@paulinevos
Copy link
Contributor Author

paulinevos commented Nov 14, 2025

lol, please hold. Forgot to add a whole bunch of tests. Feel free to review functionality in the meantime

@paulinevos paulinevos changed the title Migrate OpenAI to Responses API [WIP] Migrate OpenAI to Responses API Nov 14, 2025
@chr-hertel chr-hertel added Status: Needs Work Platform Issues & PRs about the AI Platform component labels Nov 14, 2025
@carsonbot carsonbot changed the title [WIP] Migrate OpenAI to Responses API [Platform][WIP] Migrate OpenAI to Responses API Nov 14, 2025
@chr-hertel chr-hertel marked this pull request as draft November 14, 2025 23:18
@chr-hertel chr-hertel changed the title [Platform][WIP] Migrate OpenAI to Responses API [Platform] Migrate OpenAI to Responses API Nov 14, 2025
@paulinevos paulinevos marked this pull request as ready for review November 17, 2025 11:59
@paulinevos paulinevos force-pushed the responses-migration branch 3 times, most recently from 70d3673 to 8166232 Compare November 17, 2025 14:46
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

besides that one comment the example openai/image-input-url.php throws an error for me locally:

image

does it work for you?

@OskarStark
Copy link
Contributor

I extracted the o3examples stuff to an extra PR:

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine from my end to merge after #1052 - which is needed to not break all bridges sitting on top of OpenAI ModelClients and ResultConverters.

@chr-hertel chr-hertel added the Blocked This PR is currently blocked by another topic. label Dec 7, 2025
OskarStark added a commit that referenced this pull request Dec 7, 2025
…ai embeddings- and completions-based platforms (chr-hertel)

This PR was merged into the main branch.

Discussion
----------

[Platform][Generic] Introduce generic platform for openai embeddings- and completions-based platforms

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| Docs?         | yes
| Issues        | Fix #114
| License       | MIT

Replaces #938 and unblocks #871 - diff looks a bit weird due to git mixing up removed classes and new generic bridge.

- [x] Tests
- [x] Docs
- [x] Bundle

This enables to use tools like Litellm without specific bridge with a configuration like this:
```yaml
# config/packages/ai.yaml
ai:
    platform:
        generic:
            litellm:
                base_url: '%env(LITELLM_HOST_URL)%' # e.g. http://localhost:4000
                api_key: '%env(LITELLM_API_KEY)%' # e.g. sk-1234
                model_catalog: 'Symfony\AI\Platform\Bridge\Generic\ModelCatalog' # see below
    agent:
        test:
            platform: 'ai.platform.generic.litellm'
            model: 'mistral-small-latest'
            tools: false

services:
    Symfony\AI\Platform\Bridge\Generic\ModelCatalog:
        $models:
            mistral-small-latest:
                class: 'Symfony\AI\Platform\Bridge\Generic\CompletionsModel'
                capabilities:
                    - !php/const 'Symfony\AI\Platform\Capability::INPUT_MESSAGES'
                    - !php/const 'Symfony\AI\Platform\Capability::OUTPUT_TEXT'
                    - !php/const 'Symfony\AI\Platform\Capability::OUTPUT_STREAMING'
                    - !php/const 'Symfony\AI\Platform\Capability::OUTPUT_STRUCTURED'
                    - !php/const 'Symfony\AI\Platform\Capability::INPUT_IMAGE'
                    - !php/const 'Symfony\AI\Platform\Capability::TOOL_CALLING'
```
<img width="1216" height="635" alt="image" src="https://github.com/user-attachments/assets/7984afb3-40f9-454f-9d3d-6abdba1c828a" />

Commits
-------

a42f298 Introduce generic platform for openai embeddings- and completions-based platforms
@OskarStark
Copy link
Contributor

#1052 is now merged 👍

@chr-hertel chr-hertel removed the Blocked This PR is currently blocked by another topic. label Dec 7, 2025
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was about to merge after rebase, but just found one issue with the tool call payload in combination with stream:

somehow they become part of the result:
image

@paulinevos
Copy link
Contributor Author

Thanks @chr-hertel, having a look now

@paulinevos paulinevos force-pushed the responses-migration branch 2 times, most recently from b707560 to 1029073 Compare December 8, 2025 10:57
@paulinevos paulinevos requested a review from chr-hertel December 8, 2025 10:58
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @paulinevos - can imagine that was a bit annoying 🙈 but well done! 🙏

@chr-hertel
Copy link
Member

Thank you @paulinevos.

@chr-hertel chr-hertel merged commit 41955d3 into symfony:main Dec 8, 2025
12 of 13 checks passed
@OskarStark
Copy link
Contributor

Amazing work, thank you so much 😊

chr-hertel added a commit that referenced this pull request Dec 8, 2025
…ion (chr-hertel)

This PR was merged into the main branch.

Discussion
----------

[Demo] Patch max_output_token after OpenAI responses migration

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| Issues        |
| License       | MIT

Follows #871

Commits
-------

fee3a4b Patch max_output_token after OpenAI responses migration
chr-hertel added a commit that referenced this pull request Dec 8, 2025
…gration (chr-hertel)

This PR was merged into the main branch.

Discussion
----------

[Platform][Azure] Patch Azure OpenAI after responses API migration

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| Issues        |
| License       | MIT

Follows #871

Commits
-------

fc53587 Patch Azure OpenAI after responses API migration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature Platform Issues & PRs about the AI Platform component Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Platform] Update to use the new Responses API instead of Chat Completions

6 participants