[PR #8794] [CLOSED] Add max_prompt_tokens to OpenAI compatability API #38646

Closed
opened 2026-04-22 23:19:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/8794
Author: @numine777
Created: 2/3/2025
Status: Closed

Base: mainHead: main


📝 Commits (2)

  • 6896c29 Implement max_prompt_tokens
  • 0223877 Add test case for openai max_prompt_tokens

📊 Changes

2 files changed (+57 additions, -3 deletions)

View changed files

📝 openai/openai.go (+5 -0)
📝 openai/openai_test.go (+52 -3)

📄 Description

Hey there,

I noticed that we have an issue in which we cannot turn off truncating requests to ollama made through the OpenAI compatability. Fortunately, it appears that OpenAI has a new parameter that allows us to configure it ourselves, max_prompt_tokens.

I have this running locally an it allows me to use avante.nvim with qwen2.5-coder:32b quite nicely (it was cutting out file inputs before). Hope this helps!

Fixes https://github.com/ollama/ollama/issues/6286 https://github.com/ollama/ollama/issues/5356


🔄 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/ollama/ollama/pull/8794 **Author:** [@numine777](https://github.com/numine777) **Created:** 2/3/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`6896c29`](https://github.com/ollama/ollama/commit/6896c29958444f8f1cd4316b259afef73a05a164) Implement max_prompt_tokens - [`0223877`](https://github.com/ollama/ollama/commit/0223877cb9845b93e0467ed084bef24073a959b8) Add test case for openai max_prompt_tokens ### 📊 Changes **2 files changed** (+57 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `openai/openai.go` (+5 -0) 📝 `openai/openai_test.go` (+52 -3) </details> ### 📄 Description Hey there, I noticed that we have an issue in which we cannot turn off truncating requests to ollama made through the OpenAI compatability. Fortunately, it appears that OpenAI has a new parameter that allows us to configure it ourselves, [max_prompt_tokens](https://platform.openai.com/docs/api-reference/runs-v1/createRun#runs-v1-createrun-max_prompt_tokens). I have this running locally an it allows me to use avante.nvim with qwen2.5-coder:32b quite nicely (it was cutting out file inputs before). Hope this helps! Fixes https://github.com/ollama/ollama/issues/6286 https://github.com/ollama/ollama/issues/5356 --- <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-22 23:19:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#38646