Skip to content

fix: Support max_completion_tokens option in OpenAI frontend#8226

Merged
pskiran1 merged 16 commits into
mainfrom
spolisetty_max_tokens_openai
Jun 24, 2025
Merged

fix: Support max_completion_tokens option in OpenAI frontend#8226
pskiran1 merged 16 commits into
mainfrom
spolisetty_max_tokens_openai

Conversation

@pskiran1

@pskiran1 pskiran1 commented May 30, 2025

Copy link
Copy Markdown
Member

What does the PR do?

  • Added support for max_completion_tokens.
  • Did not remove max_tokens support for the time being to maintain backward compatibility.
  • Added test cases.

Checklist

  • PR title reflects the change and is of format <commit_type>: <Title>
  • Changes are described in the pull request.
  • Related issues are referenced.
  • Populated github labels field
  • Added test plan and verified test passes.
  • Verified that the PR passes existing CI.
  • Verified copyright is correct on all changed files.
  • Added succinct git squash message before merging ref.
  • All template sections are filled out.
  • Optional: Additional screenshots for behavior/output changes with before/after.

Commit Type:

Check the conventional commit type
box here and add the label to the github PR.

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • revert
  • style
  • test

Related PRs:

Where should the reviewer start?

Test plan:

  • CI Pipeline ID: 30370160

Caveats:

Background

As mentioned in the API documentation, max_tokens is deprecated, and it is recommended to use max_completion_tokens instead. https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_tokens

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

@pskiran1 pskiran1 added PR: fix A bug fix openai OpenAI related labels Jun 4, 2025
@pskiran1 pskiran1 changed the title Support max_completion_tokens option in OpenAI frontend fix: Support max_completion_tokens option in OpenAI frontend Jun 4, 2025
@pskiran1
pskiran1 marked this pull request as ready for review June 5, 2025 08:43
Comment thread python/openai/tests/test_chat_completions.py Outdated
Comment thread python/openai/openai_frontend/schemas/openai.py
Comment thread python/openai/openai_frontend/schemas/openai.py
richardhuo-nv
richardhuo-nv previously approved these changes Jun 9, 2025
@pskiran1
pskiran1 merged commit 30e20cb into main Jun 24, 2025
3 checks passed
@pskiran1
pskiran1 deleted the spolisetty_max_tokens_openai branch June 24, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

openai OpenAI related PR: fix A bug fix

Development

Successfully merging this pull request may close these issues.

3 participants