Add Coherence to the analysis workflow#766
Merged
Merged
Conversation
This adds a migration to the table needed to store coherence evaluations. It also adds the corresponding models and factories. Much like with the answer relevancy models we will utilise concerns to levargage shared functionality. So i've included the LlmCallsRecordable and AutoEvaluationResultsCreatable concern to the CoherenceRun model.
This follows the established pattern for other auto-evaluations of adding a dedicated stub helper method for Bedrock invocations. This will be used in the various specs (mainly system) that need to stub out coherence calls.
This job adds the CoherenceJob which is essentially a copy of the AnswerRelevancyJob but for coherence evaluation. To avoid duplication i've added a shared example for all the tests since they completely overlap.
9e19aee to
3af2370
Compare
This updates the answer analysis job to include coherence evaluation. It updates the relevant specs to stub coherence model invocations.
3af2370 to
19bcfb4
Compare
19bcfb4 to
53b7ba8
Compare
This adds the coherence evaluation runs to the analysis tab of the question show page in the admin interface. It mirrors the existing answer relevancy runs display.
53b7ba8 to
d4ae892
Compare
kevindew
approved these changes
Jan 12, 2026
Member
kevindew
left a comment
There was a problem hiding this comment.
Looks good to me. Nice job with the shared specs.
I could foresee that we could hit some naming issues if we end up doing other things with auto eval, but that doesn't seem too big a concern as I guess we can start inserting the "generic" name in things if we need to.
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.
Description
This PR adds the Coherence auto-evaluation to the AnswerAnalysis workflow. It:
answer_analysis_coherence_runtable, model and factoryLLMRecordable&AutoEvaluationResultsCreatablein the coherence run modelstub_bedrock_invoke_model_openai_oss_coherenceto StubBedrockAnswerAnalysis::CoherenceJoband refactors shared metric specs into a shared_exampleScreenshots
Trello card
https://trello.com/c/KJFocexA/3047-integrate-coherence-metric-into-analysis-workflow