feat(improve-prompt): Update BFF route for evaluations - #281
Open
kaapi-agent-bot[bot] wants to merge 1 commit into
Open
kaapi-agent-bot[bot] wants to merge 1 commit into
kaapi-agent-bot[bot] wants to merge 1 commit into
Conversation
Route the improve-prompt BFF endpoint to POST /api/v2/evaluations/{id}/improve-prompt
instead of v1, and type the webhook callback as PromptRecommendationJobPublic with a
recommendation_type: "prompt" discriminant so it's ready to widen to other
recommendation types later. The Iterate on Prompt button is now disabled for v1
(cosine-only) runs, and a 422 not_a_judge_run response surfaces a clear toast.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
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.
Issue
Closes #273
Summary
improve-promptBFF route toPOST /api/v2/evaluations/{evaluation_id}/improve-promptinstead of v1.callback_urlresolution and/api/webhooks/prompt-improvementbehavior.PromptRecommendationJobPublicwithrecommendation_type: "prompt"and reject other types.422 not_a_judge_runresponse from the backend.Checklist
Before submitting a pull request, please ensure that you mark these task.
npm run devandnpm run buildin the repository root and test.Original PR description
Summary
improve-promptBFF route atPOST /api/v2/evaluations/{evaluation_id}/improve-promptinstead of v1.callback_urlresolution and/api/webhooks/prompt-improvementreceiver behavior unchanged (body shape is the same).PromptRecommendationJobPublicwith arecommendation_type: "prompt"discriminant (ready to widen to a union of recommendation types later), and reject payloads where it isn't"prompt".422 not_a_judge_runresponse from the backend.isNewScoreObjectV2check (v2 score objects carrysummary_scores/traces, v1 only hascosine_similarity) — with a tooltip explaining why.Assumptions
callback_urlplus any pass-through fields), per the issue's "body shape unchanged" note. Not verified against the live backend since this run has no network access.422error response for non-judged runs follows the existing pattern used elsewhere in this route ({ error: "not_a_judge_run" }), matching how other sync-validation codes (e.g.evaluation_not_found) are already surfaced byapiFetch/extractErrorMessage.dataobject isPromptRecommendationJobPublicwithrecommendation_type: "prompt"as the only current variant (per the issue's note "widening to a union later"); onlyjob_id,status,recommendation_type,config_version, anderror_messageare read, mirroring the previousPromptImprovementJobPublicshape.isNewScoreObjectV2(already used elsewhere in this page to distinguish v2/judge score shapes from legacy cosine-only v1 shapes) rather than adding a new backend field, since no explicitis_judge_run/judge_typefield exists inEvalJobtoday.Closes #273
🤖 Generated with Claude Code