Class: Assistant::TechnicalSupport::ResponseGroundingEvidence::Result

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries: [], citation_urls: [], tool_call_ids: [], truncated: nil) ⇒ Result

Builds immutable bounded conversation evidence.

Parameters:

  • entries (Array<Hash>) (defaults to: [])

    bounded user-message and successful-tool entries

  • citation_urls (Array<String>) (defaults to: [])

    explicit tool citation URLs

  • tool_call_ids (Array<Integer>) (defaults to: [])

    persisted tool call IDs

  • truncated (Boolean, nil) (defaults to: nil)

    whether evidence exceeded a policy bound



33
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 33

def initialize(entries: [], citation_urls: [], tool_call_ids: [], truncated: nil) = super

Instance Attribute Details

#citation_urlsObject (readonly)

Returns the value of attribute citation_urls

Returns:

  • (Object)

    the current value of citation_urls



26
27
28
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 26

def citation_urls
  @citation_urls
end

#entriesObject (readonly)

Returns the value of attribute entries

Returns:

  • (Object)

    the current value of entries



26
27
28
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 26

def entries
  @entries
end

#tool_call_idsObject (readonly)

Returns the value of attribute tool_call_ids

Returns:

  • (Object)

    the current value of tool_call_ids



26
27
28
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 26

def tool_call_ids
  @tool_call_ids
end

#truncatedObject (readonly)

Returns the value of attribute truncated

Returns:

  • (Object)

    the current value of truncated



26
27
28
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 26

def truncated
  @truncated
end

Class Method Details

.from_h(value) ⇒ Result

Rehydrates a pending JSONB evidence snapshot for asynchronous grading.

Parameters:

  • value (Hash)

    string- or symbol-keyed serialized evidence

Returns:

  • (Result)

    immutable evidence with symbol-keyed entries



44
45
46
47
48
49
50
51
52
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 44

def self.from_h(value)
  data = value.to_h.stringify_keys
  new(
    entries: Array(data['entries']).map { |entry| normalized_entry(entry) },
    citation_urls: Array(data['citation_urls']).map(&:to_s),
    tool_call_ids: Array(data['tool_call_ids']).map(&:to_i),
    truncated: data['truncated'] == true
  )
end

Instance Method Details

#truncated?Boolean?

Reports whether any evidence input exceeded a policy bound.

Returns:

  • (Boolean, nil)

    truncation state



38
# File 'app/services/assistant/technical_support/response_grounding_evidence.rb', line 38

def truncated? = truncated