Class: Assistant::TechnicalSupport::ResponseGroundingToolResult
- Inherits:
-
Object
- Object
- Assistant::TechnicalSupport::ResponseGroundingToolResult
- Includes:
- Service
- Defined in:
- app/services/assistant/technical_support/response_grounding_tool_result.rb
Overview
Converts one persisted tool call into trusted, bounded grounding evidence.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- MAX_RESULT_CHARS =
12_000- MAX_ARGUMENT_CHARS =
4_000
Instance Method Summary collapse
-
#call ⇒ Result
Parses and bounds one successful structured tool result.
Methods included from Service
#attributes_used, #build_result, call, #logger
Methods included from Service::Initializer
Instance Method Details
#call ⇒ Result
Parses and bounds one successful structured tool result.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/services/assistant/technical_support/response_grounding_tool_result.rb', line 31 def call return Result.new(truncated: true) if raw_result.length > MAX_RESULT_CHARS return Result.new unless successful? result_limit = available_chars.nil? ? MAX_RESULT_CHARS : available_chars.clamp(0, MAX_RESULT_CHARS) bounded_result = raw_result.first(result_limit) return Result.new if bounded_result.empty? citation_urls = ResponseGroundingCitationUrls.from_payload(parsed_result) Result.new( entry: entry(bounded_result, citation_urls:), citation_urls:, tool_call_id: tool_call.id, consumed_chars: bounded_result.length, truncated: bounded_result.length < raw_result.length || arguments_truncated? ) end |