Class: Assistant::TechnicalSupport::ResponseGroundingClaimCitations

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
app/services/assistant/technical_support/response_grounding_claim_citations.rb

Overview

Finds supported claims whose cited source is not one of the tool results
the grader identified as supporting that exact claim.

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Instance Method Details

#callArray<Integer>

Returns one-based indexes for claims lacking a bound citation.

Returns:

  • (Array<Integer>)

    supported claim positions without exact citations



19
20
21
22
23
# File 'app/services/assistant/technical_support/response_grounding_claim_citations.rb', line 19

def call
  claims.each_with_index.filter_map do |claim, index|
    index + 1 if claim.supported? && citation_required_for?(claim) && cited_urls_for(claim).empty?
  end
end

#citation_required?Boolean

Reports whether any supported claim relies on canonical tool evidence
and therefore requires a citation in the answer.

Returns:

  • (Boolean)

    true when at least one supported claim needs a source URL



29
30
31
# File 'app/services/assistant/technical_support/response_grounding_claim_citations.rb', line 29

def citation_required?
  claims.any? { |claim| claim.supported? && citation_required_for?(claim) }
end