mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
fix: derive ranker ranking from structured scores instead of LLM array
The JSON parsing path returned the LLM's explicit ranking array, which sometimes contradicted its own per-dimension scores. Use _scores_to_ranking() to compute the ranking from weighted scores when available, falling back to the LLM ranking only when scores are absent.
This commit is contained in:
parent
20ee6d5b62
commit
85a1c8b183
1 changed files with 6 additions and 1 deletions
|
|
@ -384,8 +384,13 @@ async def rank_optimizations( # noqa: D417
|
|||
json_response = _parse_json_response(output.content, num_candidates)
|
||||
if json_response is not None:
|
||||
logging.info("Successfully parsed JSON response")
|
||||
ranking = (
|
||||
_scores_to_ranking(json_response.scores)
|
||||
if json_response.scores is not None
|
||||
else json_response.ranking
|
||||
)
|
||||
return RankResponseSchema(
|
||||
ranking=json_response.ranking, explanation=json_response.explanation, scores=json_response.scores
|
||||
ranking=ranking, explanation=json_response.explanation, scores=json_response.scores
|
||||
)
|
||||
|
||||
# Fall back to regex parsing (legacy XML-tag format)
|
||||
|
|
|
|||
Loading…
Reference in a new issue