[PR #1487] [MERGED] Patch handling of end chunk stream events for OpenAI endpoints #3694

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

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/1487
Author: @timothycarambat
Created: 5/22/2024
Status: Merged
Merged: 5/23/2024
Merged by: @timothycarambat

Base: masterHead: patch/1475-openai-streaming-chunk


📝 Commits (4)

  • ce1a4a7 Patch handling of end chunk stream events for OpenAI endpoints
  • f751be0 update LiteLLM to use generic handler
  • 89d16a9 Merge branch 'master' into patch/1475-openai-streaming-chunk
  • ec76eed update for empty choices

📊 Changes

2 files changed (+10 additions, -43 deletions)

View changed files

📝 server/utils/AiProviders/liteLLM/index.js (+2 -41)
📝 server/utils/helpers/chat/responses.js (+8 -2)

📄 Description

Pull Request Type

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

Relevant Issues

resolves #1475
resolves #1508

Impacted LLMS to test:

  • Generic OpenAI
  • OpenAI
  • GroqAI
  • HuggingFace
  • LMStudio
  • LocalAI
  • Mistral
  • Perplexity
  • TextWebGenUI
  • TogetherAI
  • LiteLLM

What is in this change?

Path OpenAI stream handler to explicitly check for finish_reason key in message chunks before comparison as if it is non-existent it is != '' and != null and ends the stream with no data responses.

Additional Information

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

🔄 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/1487 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 5/22/2024 **Status:** ✅ Merged **Merged:** 5/23/2024 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `patch/1475-openai-streaming-chunk` --- ### 📝 Commits (4) - [`ce1a4a7`](https://github.com/Mintplex-Labs/anything-llm/commit/ce1a4a741c0fbf3ad17c611062f0a079e6863bd3) Patch handling of end chunk stream events for OpenAI endpoints - [`f751be0`](https://github.com/Mintplex-Labs/anything-llm/commit/f751be09f74fc3a34cf0cf7ac2eb8f47f6645599) update LiteLLM to use generic handler - [`89d16a9`](https://github.com/Mintplex-Labs/anything-llm/commit/89d16a9e85cbc1613691bafbf1e3afd1a07d0673) Merge branch 'master' into patch/1475-openai-streaming-chunk - [`ec76eed`](https://github.com/Mintplex-Labs/anything-llm/commit/ec76eed01bf29fc1785fe113cad87cde8e362cca) update for empty choices ### 📊 Changes **2 files changed** (+10 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/AiProviders/liteLLM/index.js` (+2 -41) 📝 `server/utils/helpers/chat/responses.js` (+8 -2) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [x] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #1475 resolves #1508 Impacted LLMS to test: - [x] Generic OpenAI - [x] OpenAI - [x] GroqAI - [x] HuggingFace - [x] LMStudio - [x] LocalAI - [x] Mistral - [x] Perplexity - [x] TextWebGenUI - [x] TogetherAI - [x] LiteLLM ### What is in this change? Path OpenAI stream handler to explicitly check for `finish_reason` key in message chunks before comparison as if it is non-existent it is` != ''` and `!= null` and ends the stream with no data responses. <!-- Describe the changes in this PR that are impactful to the repo. --> ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [ ] 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 --- <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:34:18 -05:00
yindo closed this issue 2026-02-22 18:34:18 -05:00
yindo changed title from [PR #1487] Patch handling of end chunk stream events for OpenAI endpoints to [PR #1487] [MERGED] Patch handling of end chunk stream events for OpenAI endpoints 2026-06-05 15:14:44 -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#3694