Class: Assistant::TechnicalSupport::ResponseGroundingAssessmentBuilder
- Inherits:
-
Object
- Object
- Assistant::TechnicalSupport::ResponseGroundingAssessmentBuilder
- Includes:
- Service
- Defined in:
- app/services/assistant/technical_support/response_grounding_assessment_builder.rb
Overview
Combines normalized model output with deterministic citation and evidence
checks into the bounded JSONB audit stored on an assistant message.
Constant Summary collapse
- POLICY =
{ version: 4, mode: 'shadow', service: 'technical_support', max_answer_chars: ResponseGroundingAnswerSegments::MAX_ANSWER_CHARS, max_urls: 30, max_claims: ResponseGroundingAnswerSegments::MAX_SEGMENTS }.freeze
- CONVERSATION_TYPES =
%w[technical_support technical_support_replay].freeze
- MAX_CLAIMS =
POLICY.fetch(:max_claims)
Class Method Summary collapse
-
.applies_to?(conversation) ⇒ Boolean
Reports whether a conversation explicitly belongs to this funnel.
-
.max_answer_chars ⇒ Integer
Returns the answer-size ceiling sent to the grader.
-
.mode ⇒ String
Returns the current observation mode.
-
.service ⇒ String
Returns the Sunny funnel this policy audits.
-
.version ⇒ Integer
Returns the persisted assessment schema version.
Instance Method Summary collapse
-
#call ⇒ Hash
Builds the complete persisted assessment payload.
Methods included from Service
#attributes_used, #build_result, call, #logger
Methods included from Service::Initializer
Class Method Details
.applies_to?(conversation) ⇒ Boolean
Reports whether a conversation explicitly belongs to this funnel.
52 53 54 |
# File 'app/services/assistant/technical_support/response_grounding_assessment_builder.rb', line 52 def applies_to?(conversation) CONVERSATION_TYPES.include?(conversation&.conversation_type.to_s) end |
.max_answer_chars ⇒ Integer
Returns the answer-size ceiling sent to the grader.
59 |
# File 'app/services/assistant/technical_support/response_grounding_assessment_builder.rb', line 59 def max_answer_chars = POLICY.fetch(:max_answer_chars) |
.mode ⇒ String
Returns the current observation mode.
41 |
# File 'app/services/assistant/technical_support/response_grounding_assessment_builder.rb', line 41 def mode = POLICY.fetch(:mode) |
.service ⇒ String
Returns the Sunny funnel this policy audits.
46 |
# File 'app/services/assistant/technical_support/response_grounding_assessment_builder.rb', line 46 def service = POLICY.fetch(:service) |
.version ⇒ Integer
Returns the persisted assessment schema version.
36 |
# File 'app/services/assistant/technical_support/response_grounding_assessment_builder.rb', line 36 def version = POLICY.fetch(:version) |
Instance Method Details
#call ⇒ Hash
Builds the complete persisted assessment payload.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/services/assistant/technical_support/response_grounding_assessment_builder.rb', line 65 def call decision = build_decision ResponseGroundingAssessmentPayload.call( answer: answer_text, model:, evidence:, decision:, user_message_id:, assistant_message: ).merge(normalized_analysis) end |