[PR #10363] [MERGED] feat: Update Payload's apply_model_params_to_body_ollama with full Ollama supported options #22509

Closed
opened 2026-04-20 04:12:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/10363
Author: @ferret99gt
Created: 2/19/2025
Status: Merged
Merged: 2/19/2025
Merged by: @tjbck

Base: devHead: ollama-model-option-conversion-updates


📝 Commits (6)

  • cee08e3 Update Ollama request option list with full supported options
  • 6b2ba73 Remove tfs_z
  • 877d21a Move parameter remapping above the opt dictionary.
  • a4249a6 Remove remapping of frequency_penalty to repeat_penalty
  • fa885c3 Update remapping logic
  • 5701d6d Change the opt dictionary to a mappings dictionary with appropriate casts

📊 Changes

1 file changed (+36 additions, -25 deletions)

View changed files

📝 backend/open_webui/utils/payload.py (+36 -25)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

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:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • This is part 2 of 2 of recreating PR #10015 more atomicly.
  • The goal is to update Payload.py's apply_model_params_to_body_ollama to handle all valid Ollama request options (See https://github.com/ollama/ollama/blob/main/docs/api.md#request-8), and make it consistent with OpenAI's apply_model_params_to_body_openai.
  • Each commit is very atomic with notes, please let me know if this was too granular.

Added

  • Added options: num_predict, typical_p, frequency_penalty, penalize_newline, stop, numa, main_gpu, low_vram, vocab_only
  • Also added options for the following, needed to support PR #10016: repeat_penalty, presence_penalty

Changed

  • Perform remapping of max_tokens to num_predict before calling apply_model_params_to_body. This ensures it gets cast appropriately if needed, whereas before it came after the call to apply_model_params_to_body.
  • Converted the list of options to a mapping with cast_funcs, to be consistent with apply_model_params_to_body_openai

Removed

  • Removed frequency_penalty being remapped to repeat_penalty. Ollama supports both. PR #10016 adds support for repeat_penalty so Ollama users can pick either.
  • Removed mapping for tfs_z, as Llama.cpp and Ollama dropped support in January 2025.

Additional Information

  • Originally submitted as PR #10015 but broken up to be more atomic.
  • Originally opened as a discussion as #9770.

🔄 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/10363 **Author:** [@ferret99gt](https://github.com/ferret99gt) **Created:** 2/19/2025 **Status:** ✅ Merged **Merged:** 2/19/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `ollama-model-option-conversion-updates` --- ### 📝 Commits (6) - [`cee08e3`](https://github.com/open-webui/open-webui/commit/cee08e316d7233046aed6bdf959a3c7381dc4cd5) Update Ollama request option list with full supported options - [`6b2ba73`](https://github.com/open-webui/open-webui/commit/6b2ba7370112b20a7ce4abd50e75e85abe68305d) Remove tfs_z - [`877d21a`](https://github.com/open-webui/open-webui/commit/877d21a02977d0462a82a712cd9523824dd284c1) Move parameter remapping above the opt dictionary. - [`a4249a6`](https://github.com/open-webui/open-webui/commit/a4249a63511a7ed8ed10872c59a5235dcadfa8dd) Remove remapping of frequency_penalty to repeat_penalty - [`fa885c3`](https://github.com/open-webui/open-webui/commit/fa885c33465433bbdb31cd90390a43d6f3617630) Update remapping logic - [`5701d6d`](https://github.com/open-webui/open-webui/commit/5701d6d3337a7bf5d265f717936d36e1c39d0ee8) Change the opt dictionary to a mappings dictionary with appropriate casts ### 📊 Changes **1 file changed** (+36 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/payload.py` (+36 -25) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **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: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - This is part 2 of 2 of recreating PR #10015 more atomicly. - The goal is to update Payload.py's apply_model_params_to_body_ollama to handle all valid Ollama request options (See https://github.com/ollama/ollama/blob/main/docs/api.md#request-8), and make it consistent with OpenAI's apply_model_params_to_body_openai. - Each commit is very atomic with notes, please let me know if this was *too* granular. ### Added - Added options: num_predict, typical_p, frequency_penalty, penalize_newline, stop, numa, main_gpu, low_vram, vocab_only - Also added options for the following, needed to support PR #10016: repeat_penalty, presence_penalty ### Changed - Perform remapping of max_tokens to num_predict before calling apply_model_params_to_body. This ensures it gets cast appropriately if needed, whereas before it came after the call to apply_model_params_to_body. - Converted the list of options to a mapping with cast_funcs, to be consistent with apply_model_params_to_body_openai ### Removed - Removed frequency_penalty being remapped to repeat_penalty. Ollama supports both. PR #10016 adds support for repeat_penalty so Ollama users can pick either. - Removed mapping for tfs_z, as Llama.cpp and Ollama dropped support in January 2025. --- ### Additional Information - Originally submitted as PR #10015 but broken up to be more atomic. - Originally opened as a discussion as #9770. --- <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 2026-04-20 04:12:05 -05: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#22509