You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix!: build judge input as string and narrow Runner.run signature
Aligns the JS AI SDK with the spec change implemented in
launchdarkly/python-server-sdk-ai#165 and launchdarkly/sdk-specs#160.
Judges now build a single formatted string ("MESSAGE HISTORY:\n...\n\n
RESPONSE TO EVALUATE:\n...") and pass it to the runner instead of an
interpolated message list. Legacy judge configs that contain
{{message_history}} or {{response_to_evaluate}} placeholders in
non-system messages are stripped at config-construction time so old and
new flag values both work without behavioral surprises.
BREAKING CHANGE: Runner.run is narrowed from
`run(input: string | LDMessage[], outputType?)` to
`run(input: string, outputType?)`. The OpenAI, LangChain, and Vercel
provider runners no longer accept a pre-built message array; they
always prepend any config messages and append the prompt as a user
turn. The Judge no longer interpolates {{message_history}} or
{{response_to_evaluate}} into config messages — the SDK builds the
input string directly and the runner receives that string verbatim.
The "Judge configuration must include messages" early-return was
removed; a judge with no messages now proceeds to invoke the runner
with the formatted input.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
errorMessage: 'Judge configuration must include messages',
428
-
judgeConfigKey: 'test-judge',
429
-
});
430
-
expect(mockLogger.warn).toHaveBeenCalledWith(
431
-
'Judge configuration must include messages',
432
-
mockTrackData,
433
-
);
504
+
expect(result.sampled).toBe(true);
505
+
expect(result.success).toBe(true);
506
+
expect(mockRunner.run).toHaveBeenCalledTimes(1);
434
507
});
435
508
436
509
it('returns result with success false when parsed is undefined or has no score/reasoning',async()=>{
@@ -588,17 +661,7 @@ describe('Judge', () => {
588
661
});
589
662
590
663
expect(mockRunner.run).toHaveBeenCalledWith(
591
-
expect.arrayContaining([
592
-
expect.objectContaining({
593
-
role: 'system',
594
-
content: 'You are a helpful judge that evaluates AI responses.',
595
-
}),
596
-
expect.objectContaining({
597
-
role: 'user',
598
-
content:
599
-
'Evaluate and report scores for important metrics: Input: What is the capital of France?\r\nParis is the capital of France., Output: Paris is the capital of France.',
600
-
}),
601
-
]),
664
+
'MESSAGE HISTORY:\nWhat is the capital of France?\r\nParis is the capital of France.\n\nRESPONSE TO EVALUATE:\nParis is the capital of France.',
0 commit comments