Skip to content

Fix OpenAI completion args routing#1653

Open
kayametehan wants to merge 1 commit intoopenai:mainfrom
kayametehan:fix/completion-args-routing
Open

Fix OpenAI completion args routing#1653
kayametehan wants to merge 1 commit intoopenai:mainfrom
kayametehan:fix/completion-args-routing

Conversation

@kayametehan
Copy link
Copy Markdown

Fixes #1493 and #1504.

Overview

--completion_args currently breaks in two ways for OpenAI completion functions:

  1. OpenAIChatCompletionFn rejects extra kwargs such as temperature
  2. OpenAICompletionFn accepts extra kwargs but silently drops them instead of forwarding them to the API request options

There is also a related registry-plumbing issue where registry can be passed into OpenAIChatCompletionFn when the class is referenced from the registry.

What changed

  • Allow OpenAIChatCompletionFn to accept extra kwargs
  • Promote extra constructor kwargs into extra_options for both OpenAI completion function classes
  • Ignore registry plumbing kwargs instead of forwarding them to the API request
  • Reuse numeric coercion for --completion_args, so values like temperature=0.5 and max_tokens=10 are parsed as numbers rather than strings
  • Add focused regression tests for constructor behavior, registry routing, and CLI parsing

Validation

I verified this change before pushing with:

  • python -m pytest evals/completion_fns/openai_test.py evals/cli/oaieval_test.py -q
  • python -m pytest evals/registry_test.py evals/completion_fns/openai_test.py evals/cli/oaieval_test.py -q
  • direct constructor / registry behavior checks for temperature and max_tokens
  • git diff --check

Copilot AI review requested due to automatic review settings April 23, 2026 18:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAIChatCompletionFn should __init__ should accept **kwargs

2 participants