[PR #4467] [MERGED] Migrate OpenAI Agent to use ResponsesAPI #4633

Closed
opened 2026-02-22 18:36:13 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4467
Author: @timothycarambat
Created: 10/1/2025
Status: Merged
Merged: 10/1/2025
Merged by: @timothycarambat

Base: masterHead: 4465-migrate-openai-agent-to-responses


📝 Commits (2)

  • 9476205 Migrate OpenAI Agent to use ResponsesAPI
  • e5bc031 Merge branch 'master' into 4465-migrate-openai-agent-to-responses

📊 Changes

3 files changed (+239 additions, -32 deletions)

View changed files

📝 server/utils/agents/aibitat/index.js (+4 -0)
📝 server/utils/agents/aibitat/providers/anthropic.js (+1 -1)
📝 server/utils/agents/aibitat/providers/openai.js (+234 -31)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #4465

What is in this change?

Migrate OpenAI aibitat provider to use the Responses API from the OpenAI SDK. This allows us to easily support both past and future models through a unified API so now you can use agents for gpt-5 and the o-* models as well as the previous models that have already been launched.

Additional Information

Due to the unique flow by the responses API:

  • OpenAI provider now has its own stream and complete functions on its class to override the inherited Provider which still will use completions (for unification of interface among all other LLM providers)
  • Required us to add originalFunctionCall to the stream and non-stream handler for the main aibitat class so that we can consistently rebuild the function call post-execution since the message history must have a matching function_call and function_call_output in the messages array in order to be valid.

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

Additional QA

  • Test new models (gpt-5, o-*, etc)
  • Test older gen models like 3.5
  • Test with and without tools available
  • Test with streaming disabled (manually) to force complete to run
  • Test with followup messages, multiple tool calls, etc.
  • Test existing providers for spot check for changes introduced to the aibitat handlers.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4467 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 10/1/2025 **Status:** ✅ Merged **Merged:** 10/1/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `4465-migrate-openai-agent-to-responses` --- ### 📝 Commits (2) - [`9476205`](https://github.com/Mintplex-Labs/anything-llm/commit/947620581f553652d540c8c7e101a28f13392274) Migrate OpenAI Agent to use ResponsesAPI - [`e5bc031`](https://github.com/Mintplex-Labs/anything-llm/commit/e5bc031dac8e3d6cd2258f184d200257ac0740a2) Merge branch 'master' into 4465-migrate-openai-agent-to-responses ### 📊 Changes **3 files changed** (+239 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/agents/aibitat/index.js` (+4 -0) 📝 `server/utils/agents/aibitat/providers/anthropic.js` (+1 -1) 📝 `server/utils/agents/aibitat/providers/openai.js` (+234 -31) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [x] ✨ feat - [x] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #4465 ### What is in this change? Migrate OpenAI `aibitat` provider to use the `Responses` API from the OpenAI SDK. This allows us to easily support both past and future models through a unified API so now you can use agents for `gpt-5` and the `o-*` models as well as the previous models that have already been launched. <!-- Describe the changes in this PR that are impactful to the repo. --> ### Additional Information Due to the unique flow by the responses API: - OpenAI provider now has its own stream and complete functions on its class to override the inherited `Provider` which still will use completions (for unification of interface among all other LLM providers) - Required us to add `originalFunctionCall` to the stream and non-stream handler for the main aibitat class so that we can consistently rebuild the function call post-execution since the message history must have a matching `function_call` and `function_call_output` in the messages array in order to be valid. <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally ### Additional QA - [x] Test new models (gpt-5, o-*, etc) - [x] Test older gen models like 3.5 - [x] Test with and without tools available - [ ] Test with streaming disabled (manually) to force `complete` to run - [ ] Test with followup messages, multiple tool calls, etc. - [ ] Test existing providers for spot check for changes introduced to the aibitat handlers. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:13 -05:00
yindo closed this issue 2026-02-22 18:36:13 -05:00
yindo changed title from [PR #4467] Migrate OpenAI Agent to use ResponsesAPI to [PR #4467] [MERGED] Migrate OpenAI Agent to use ResponsesAPI 2026-06-05 15:19:33 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4633