feat: carry judge reasoning in the judge track payload and telemetry - #48
Draft
tracisiebel wants to merge 5 commits into
Draft
tracisiebel wants to merge 5 commits into
tracisiebel wants to merge 5 commits into
Conversation
Co-Authored-By: traci@launchdarkly.com <traci@launchdarkly.com>
Co-Authored-By: traci@launchdarkly.com <traci@launchdarkly.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
@cursor review |
Co-Authored-By: traci@launchdarkly.com <traci@launchdarkly.com>
Contributor
Author
|
devin - can you resolve conflicts here plz |
… event Co-Authored-By: traci@launchdarkly.com <traci@launchdarkly.com>
Contributor
|
Conflicts resolved — |
…n risk Co-Authored-By: traci@launchdarkly.com <traci@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.
Summary
Judge reasoning is parsed on every sampled evaluation and then thrown away:
run_judgesputs it in the returnedJudgeResultandclient.track(...)sends only the score. This carries it off the process, both on the evaluation metric event and on the judge's evaluation span event, behind an explicit opt-in.TrackData.judgeReasoningnow rides the judge's evaluation metric event, on the inline path and on the deferredrun_judgepath, so reasoning reaches LaunchDarkly through the evaluation pipeline that already carries the score.LD_CAPTURE_JUDGE_REASONING=true(1/on/yes) is required before reasoning leaves the process; unset means score only.capture_content, so a caller who wants this one field is not forced to ship every request and response.Requested as a must-have: reasoning is visible nowhere in the dashboard because the data never leaves the customer's process, and customers are shipping it to LD Observability by hand to route around the eval pipeline.
Implementation details
Relationship to #43. #43 landed on
mainand already emitsgen_ai.evaluation.result/gen_ai.evaluation.explanationon the judge's owninvoke_agentspan. This branch originally added a separatelaunchdarkly.judgespan withlaunchdarkly.judge.*attributes; that is dropped in the merge in favour of #43's semconv shape, so there is one judge telemetry vocabulary rather than two. What remains from this PR is the part #43 does not cover: reasoning on the LD track payload, and the opt-in being a dedicated switch rather than whole-conversation capture.Why opt-in. An earlier revision of this PR defaulted the capture on, reasoning that a score with no explanation is a number nobody can act on. That is an exfiltration risk: the judge is handed the entire response it grades, and its reasoning is free-form model prose that can quote sensitive spans verbatim. Nothing short of a second inference pass or PII detection can rule that out, so the default is now off and
TELEMETRY-CONTRACT.md§4a carries the warning. Keeping the switch independent ofcapture_contentstill means opting in costs one field, not the whole conversation.Scope. No handler package touched, no new dependency.
uv.lockchurn from running the toolchain was left out of the commits.Testing.
packages/client/tests/test_judges.pycovers the track payload, the default-off behaviour (score retained, reasoning absent), empty reasoning, truncation, thecapture_content-independent explanation, and the deferredrun_judgepayload.make lint,make format-check,mypy packages/client/srcand the full suite (495 passed, 11 skipped) pass locally.Not done here. The Monitoring surface that displays reasoning next to the score is a platform-side change; this PR only makes the data available.
Link to Devin session: https://app.devin.ai/sessions/e4c538a50a4141d7af1bcc8c424d0f11
Open in Devin Desktop: https://app.devin.ai/desktop/session/e4c538a50a4141d7af1bcc8c424d0f11?variant=devin
Requested by: @tracisiebel