🐛 Fix: avoid duplicate stream keyword in evaluator LLM calls - #3836
Merged
Conversation
cj2026-bit
requested review from
Dallas98,
WMC001 and
jeffwu-1999
as code owners
September 1, 2026 03:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport the evaluator stream compatibility fix from PR #3829 to main without waiting for the next release.
Problem
The in-process LLM client caching feature introduced reusable model clients. After that change, the evaluator path was not adapted to cached completion parameters.
When _prepare_completion_kwargs() retained a construction-time stream value, the evaluator also passed stream=True, which could result in:
TypeError: got multiple values for keyword argument 'stream'
This affected evaluator-related requests such as AI-generated evaluation sets, AI-generated evaluators, and LLM Judge evaluation calls.
The normal conversation path already removed the stale parameter, but the evaluator path was missing the same compatibility handling.
Solution
Remove any existing stream value before forcing evaluator requests to use streaming:
completion_kwargs.pop('stream', None)
current_request = llm.client.chat.completions.create(stream=True, **completion_kwargs)
Other completion parameters are preserved unchanged.
Tests
Added a regression test that simulates a cached client returning stream=False and verifies that the final request contains only stream=True.
Validation
Scope
Only the evaluator compatibility fix and its regression test are included. No API, database schema, or model configuration changes.
Validation Screenshots