[PR #10338] [CLOSED] **fix** Fixed many little bugs in exposed API #9295

Closed
opened 2025-11-11 18:19:07 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/10338
Author: @Seniorsimo
Created: 2/19/2025
Status: Closed

Base: devHead: langchain_integration


📝 Commits (6)

  • d317085 fixed usage
  • 3f8c446 Fix on ChatMessage validator: content can be null when using tools
  • 0758abc Add support for tool message in openai to Ollama message conversion
  • c4617be Fix on ollama to openai conversion - stream can return a single message with response
  • 0a0b756 Added "stop" parameter mapping to ollama
  • c6c1414 Merge branch 'dev' into langchain_integration

📊 Changes

3 files changed (+58 additions, -83 deletions)

View changed files

📝 backend/open_webui/routers/ollama.py (+11 -2)
📝 backend/open_webui/utils/payload.py (+29 -1)
📝 backend/open_webui/utils/response.py (+18 -80)

📄 Description

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • 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 Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:

Changelog Entry

Description

Added

  • Added support for tool_calls and tool_call_id added
  • Added mapping for the stop parameter added

Changed

  • Changed the usage returned by the API to match the OpenAI standard changes

Fixed

  • ChatMessage validator should handle message with null content when tool calls are present fix
  • Ollama to OpenAI conversion shoul handle case when stream=true and a one shot message is generated fix

Additional Information

All the changes are tested and validated using this notebook file.
https://gist.github.com/Seniorsimo/214e39d7da6a72bff98f265a39c2fa14

Tested the varius intagration using:

  • OpenAI vs Open WebUI (gpt-3.5-turbo)
  • Ollama vs Open WebUI (qwen2.5:14b)

🔄 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/10338 **Author:** [@Seniorsimo](https://github.com/Seniorsimo) **Created:** 2/19/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `langchain_integration` --- ### 📝 Commits (6) - [`d317085`](https://github.com/open-webui/open-webui/commit/d317085dd81522a3d5ac09abdc8b4a38fc273763) fixed usage - [`3f8c446`](https://github.com/open-webui/open-webui/commit/3f8c446f2f95379ca511a206f1cd658b01927937) Fix on ChatMessage validator: content can be null when using tools - [`0758abc`](https://github.com/open-webui/open-webui/commit/0758abc49551a2d810f9b85138acd371a29f3785) Add support for tool message in openai to Ollama message conversion - [`c4617be`](https://github.com/open-webui/open-webui/commit/c4617bea2e6fbb1616a98e3781fcf2a98553bbfc) Fix on ollama to openai conversion - stream can return a single message with response - [`0a0b756`](https://github.com/open-webui/open-webui/commit/0a0b75692f3101c7de2225a731ec62202477f4ea) Added "stop" parameter mapping to ollama - [`c6c1414`](https://github.com/open-webui/open-webui/commit/c6c1414f2c9d6b755714d709f9a54bac792a9ed5) Merge branch 'dev' into langchain_integration ### 📊 Changes **3 files changed** (+58 additions, -83 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/ollama.py` (+11 -2) 📝 `backend/open_webui/utils/payload.py` (+29 -1) 📝 `backend/open_webui/utils/response.py` (+18 -80) </details> ### 📄 Description # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests for validating the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following: # Changelog Entry ### Description - Discussion: https://github.com/open-webui/open-webui/discussions/10089 - Fixing many little bugs on the exposed API that prevents integration with external tools (for example langchain in my case). ### Added - Added support for `tool_calls` and `tool_call_id` [added](https://github.com/open-webui/open-webui/commit/0758abc49551a2d810f9b85138acd371a29f3785) - Added mapping for the `stop` parameter [added](https://github.com/open-webui/open-webui/commit/0a0b75692f3101c7de2225a731ec62202477f4ea) ### Changed - Changed the `usage` returned by the API to match the OpenAI standard [changes](https://github.com/open-webui/open-webui/commit/d317085dd81522a3d5ac09abdc8b4a38fc273763) ### Fixed - ChatMessage validator should handle message with null content when tool calls are present [fix](https://github.com/open-webui/open-webui/commit/3f8c446f2f95379ca511a206f1cd658b01927937) - Ollama to OpenAI conversion shoul handle case when stream=true and a one shot message is generated [fix](https://github.com/open-webui/open-webui/commit/c4617bea2e6fbb1616a98e3781fcf2a98553bbfc) --- ### Additional Information All the changes are tested and validated using this notebook file. https://gist.github.com/Seniorsimo/214e39d7da6a72bff98f265a39c2fa14 Tested the varius intagration using: - OpenAI vs Open WebUI (gpt-3.5-turbo) - Ollama vs Open WebUI (qwen2.5:14b) --- <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 18:19:07 -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#9295