mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
fix: send max_completion_tokens for Bedrock-prefixed OpenAI models (#30976)
On an Amazon Bedrock OpenAI-compatible connection, GPT-5.6 and GPT-6 models have ids like `us.openai.gpt-6-sol` or `openai.gpt-6-luna`. These were not recognised as new OpenAI models, so `max_tokens` went upstream unchanged and Bedrock rejected it with a 400. Title and emoji generation failed on every chat, and any request with a token limit failed too. Setting `max_completion_tokens` by hand did not help, because non-OpenAI URLs convert it back to `max_tokens`. `is_openai_new_model()` now drops a leading `openai.` or `<region>.openai.` (`us.`, `eu.`, `global.`, `us-gov.`) before matching, so these ids get the same handling as bare `gpt-5` ids. Ids that are not new models, such as `openai.gpt-oss-120b-1:0` and `gpt-4o`, are unchanged, and so is the LiteLLM `openai/` prefix. Fixes #30510
This commit is contained in:
parent
101cdb6f78
commit
9d2c3965ff
1 changed files with 2 additions and 1 deletions
|
|
@ -1109,7 +1109,8 @@ def get_azure_allowed_params(api_version: str) -> set[str]:
|
|||
|
||||
|
||||
def is_openai_new_model(model: str) -> bool:
|
||||
model_lower = model.lower()
|
||||
# Amazon Bedrock ids carry a provider prefix, e.g. us.openai.gpt-6-sol
|
||||
model_lower = re.sub(r'^(?:[a-z-]+\.)?openai\.', '', model.lower())
|
||||
# o-series models (o1, o3, o4, o5, ...)
|
||||
if re.match(r'^o\d+', model_lower):
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue