Class: Assistant::TechnicalSupport::ResponseGroundingEvidence

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

Overview

Selects and bounds the user observations and successful canonical tool
results that remain available in the live conversation transcript.

Defined Under Namespace

Classes: Result

Constant Summary collapse

MAX_TOOL_CALLS =
24
MAX_USER_MESSAGES =
8
MAX_USER_MESSAGE_CHARS =
4_000
MAX_USER_EVIDENCE_CHARS =
12_000
MAX_TOOL_EVIDENCE_CHARS =
60_000
MAX_EVIDENCE_ENTRIES =
MAX_TOOL_CALLS + MAX_USER_MESSAGES
MAX_TOTAL_EVIDENCE_CHARS =
MAX_TOOL_EVIDENCE_CHARS + MAX_USER_EVIDENCE_CHARS
MAX_URLS =
ResponseGroundingAssessmentBuilder::POLICY.fetch(:max_urls)
LEGACY_TOOL_RESULT_SOURCE =
'tool_result'

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Class Method Details

.canonical_tool_entry?(entry) ⇒ Boolean

Reports whether an evidence entry is canonical technical-tool output.
Source-less entries are persisted policy-v3 snapshots, which contained
tool results exclusively.

Parameters:

  • entry (Hash)

    one normalized grounding-evidence entry

Returns:

  • (Boolean)

    true for current or legacy canonical tool evidence



69
70
71
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 69

def self.canonical_tool_entry?(entry)
  entry.fetch(:source, LEGACY_TOOL_RESULT_SOURCE) == 'tool_result'
end

Instance Method Details

#callResult

Collects bounded context that was available to the assistant answer.

Returns:

  • (Result)

    bounded conversation evidence and citation provenance



76
77
78
79
80
81
82
83
84
85
86
87
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 76

def call
  initialize_collection
  collect_entries
  citation_urls = bounded_citation_urls

  Result.new(
    entries: @entries,
    citation_urls:,
    tool_call_ids: @tool_call_ids,
    truncated: @truncated
  )
end