fix: Remove evaluation metric key from schema which failed on some LLMs#105
Merged
jsonbailey merged 11 commits intomainfrom Mar 16, 2026
Merged
Conversation
kinyoklion
approved these changes
Mar 13, 2026
packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_provider.py
Outdated
Show resolved
Hide resolved
packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_provider.py
Show resolved
Hide resolved
packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_provider.py
Show resolved
Hide resolved
packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_provider.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
packages/ai-providers/server-ai-langchain/src/ldai_langchain/langchain_provider.py
Show resolved
Hide resolved
Merged
jsonbailey
added a commit
that referenced
this pull request
Mar 16, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>launchdarkly-server-sdk-ai: 0.16.1</summary> ## [0.16.1](launchdarkly-server-sdk-ai-0.16.0...launchdarkly-server-sdk-ai-0.16.1) (2026-03-16) ### Bug Fixes * Improve metric token collection for Judge evaluations when using LangChain ([f951dac](f951dac)) * Improved raw response when performing Judge evaluations using LangChain ([f951dac](f951dac)) * Simplify judge structured output for improve reliability for judge scores for some LLMs ([#105](#105)) ([f951dac](f951dac)) </details> <details><summary>launchdarkly-server-sdk-ai-langchain: 0.3.2</summary> ## [0.3.2](launchdarkly-server-sdk-ai-langchain-0.3.1...launchdarkly-server-sdk-ai-langchain-0.3.2) (2026-03-16) ### Bug Fixes * Improve metric token collection for Judge evaluations when using LangChain ([f951dac](f951dac)) * Improved raw response when performing Judge evaluations using LangChain ([f951dac](f951dac)) * Simplify judge structured output for improve reliability for judge scores for some LLMs ([#105](#105)) ([f951dac](f951dac)) * Update comments for setting default ([#99](#99)) ([a14761d](a14761d)) </details> <details><summary>launchdarkly-server-sdk-ai-openai: 0.2.1</summary> ## [0.2.1](launchdarkly-server-sdk-ai-openai-0.2.0...launchdarkly-server-sdk-ai-openai-0.2.1) (2026-03-16) ### Bug Fixes * Update comments for setting default ([#99](#99)) ([a14761d](a14761d)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > This is a Release Please version/changelog update only, touching manifests and package metadata but no functional runtime code. Risk is low aside from potential release/versioning inconsistencies if any file was missed. > > **Overview** > Publishes a new release by bumping versions for `launchdarkly-server-sdk-ai` to `0.16.1`, `launchdarkly-server-sdk-ai-langchain` to `0.3.2`, and `launchdarkly-server-sdk-ai-openai` to `0.2.1` (manifest, `pyproject.toml`, and `ldai.__version__`). > > Updates changelogs (and `PROVENANCE.md` version snippet) to reflect the included bug fixes around Judge evaluation output/metrics and documentation comments. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 380481b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: jsonbailey <jbailey@launchdarkly.com>
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.

fix: Improve metric token collection for Judge evaluations when using LangChain
fix: Include raw response when performing Judge evaluations
Note
Medium Risk
Updates the judge structured-output contract and parsing logic, plus changes LangChain structured invocation to return parsed/raw data and token usage; this could affect downstream integrations expecting the old schema or metrics behavior.
Overview
Judge evaluations now use a fixed structured-output shape.
EvaluationSchemaBuilderno longer bakesevaluation_metric_keyinto the schema;Judgenow expects top-level{score, reasoning}and keys the parsed result by the config’s metric key, failing the evaluation when the response doesn’t parse into a valid score/reasoning.LangChain structured invocations now capture more telemetry and handle Bedrock better.
invoke_structured_modelusesinclude_raw=True, returns only theparsedpayload, surfacesraw_response, extracts token usage from eitherusage_metadataorresponse_metadata, and treatsparsing_erroras a failed structured call; provider mapping now routesbedrockandbedrock:*tobedrock_converseand injects Bedrock’s foundationproviderparameter when needed.Written by Cursor Bugbot for commit a303c3d. This will update automatically on new commits. Configure here.