[PR #927] [MERGED] Fix OpenAI integration: allow OpenAI to make chat completion calls with a valid API key #7331

Closed
opened 2025-11-11 17:23:40 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/927
Author: @sakkus-ai
Created: 2/26/2024
Status: Merged
Merged: 2/28/2024
Merged by: @tjbck

Base: devHead: fix-openai-integration


📝 Commits (10+)

📊 Changes

2 files changed (+8 additions, -0 deletions)

View changed files

📝 .github/workflows/docker-build.yaml (+1 -0)
📝 backend/apps/openai/main.py (+7 -0)

📄 Description

From docker on mac get errors since num_ctx not recognized; remove num_ctx from, and add max_tokens to, body in API calls.

Pull Request Checklist

  • Description:
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?

Description

Model file calls to the OpenAI API works fine, but chat completions fail withan error related to num_ctx in the body of the call.

backend/openai/main.py has a change to the main route to remove num_ctx from the body; this is replaced with max_tokens.

Chat completions now work.


Changelog Entry

Fixed

  • Bug fix to allow chat completion API calls to OpenAI to work without num_ctx parameter error.

🔄 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/open-webui/open-webui/pull/927 **Author:** [@sakkus-ai](https://github.com/sakkus-ai) **Created:** 2/26/2024 **Status:** ✅ Merged **Merged:** 2/28/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix-openai-integration` --- ### 📝 Commits (10+) - [`3c10c3b`](https://github.com/open-webui/open-webui/commit/3c10c3b928097035655e913eaf0e5dfc900f0f25) Merge pull request #910 from open-webui/dev - [`81a50c5`](https://github.com/open-webui/open-webui/commit/81a50c510419374e47ef36be16d91f157fdb4a1e) Merge pull request #912 from open-webui/dev - [`588daac`](https://github.com/open-webui/open-webui/commit/588daace910ab8d828091c2a2709e77ef55d4565) Merge pull request #913 from open-webui/dev - [`0a2ee69`](https://github.com/open-webui/open-webui/commit/0a2ee691dbb3f5029e4e1c5352a82bd11e17ed5a) fix: add semver to container builds - [`6b0eae9`](https://github.com/open-webui/open-webui/commit/6b0eae9fad7cf2ac8d7a4e40a1b7912dc0ba8c8c) Merge pull request #915 from open-webui/dev - [`334d524`](https://github.com/open-webui/open-webui/commit/334d5246ba18d3297182f91a66f1f9d7b89ea0b4) Merge pull request #916 from open-webui/dev - [`95dd618`](https://github.com/open-webui/open-webui/commit/95dd618a626f41551d7acaa095be824299c860c3) Merge pull request #914 from buroa/main - [`6df2505`](https://github.com/open-webui/open-webui/commit/6df2505bf0352a7580b33f17ce6844afe04fb7be) Merge pull request #919 from open-webui/dev - [`bbeaa92`](https://github.com/open-webui/open-webui/commit/bbeaa929041d46c59694798899a13ace46039cd2) Fix OpenAI integration: - [`781be27`](https://github.com/open-webui/open-webui/commit/781be2779bb6a20d719f8134a6b17a994358c51b) refac: unnecessary max_token value removed ### 📊 Changes **2 files changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/docker-build.yaml` (+1 -0) 📝 `backend/apps/openai/main.py` (+7 -0) </details> ### 📄 Description From docker on mac get errors since num_ctx not recognized; remove num_ctx from, and add max_tokens to, body in API calls. ## Pull Request Checklist - [ ] **Description:** - [ ] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation? - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? --- ## Description Model file calls to the OpenAI API works fine, but chat completions fail withan error related to num_ctx in the body of the call. backend/openai/main.py has a change to the main route to remove num_ctx from the body; this is replaced with max_tokens. Chat completions now work. --- ### Changelog Entry ### Fixed - Bug fix to allow chat completion API calls to OpenAI to work without num_ctx parameter error. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 17:23:40 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#7331