Module: RailsAiBridge::Tools::ConfidenceTag

Defined in:
lib/rails_ai_bridge/tools/confidence_tag.rb

Overview

Maps an evidence source to a compact [VERIFIED] / [INFERRED] tag.

Verified only when ActiveRecord reflection or rubydex/Prism agrees. Source-regex extracts and static schema parses stay inferred. Unknown sources under-claim as inferred — there is no third status.

Constant Summary collapse

VERIFIED =
'[VERIFIED]'
INFERRED =
'[INFERRED]'
VERIFIED_SOURCES =
%i[reflection rubydex prism live].freeze

Class Method Summary collapse

Class Method Details

.tag(source) ⇒ String

Returns [VERIFIED] or [INFERRED].

Parameters:

  • source (Symbol, String, nil)

    evidence origin

Returns:

  • (String)

    [VERIFIED] or [INFERRED]



20
21
22
23
24
# File 'lib/rails_ai_bridge/tools/confidence_tag.rb', line 20

def tag(source)
  return INFERRED if source.nil?

  VERIFIED_SOURCES.include?(source.to_sym) ? VERIFIED : INFERRED
end

.tagged(text, source) ⇒ String

Returns text with a trailing confidence tag.

Parameters:

  • text (String)

    fact line without a tag

  • source (Symbol, String, nil)

    evidence origin

Returns:

  • (String)

    text with a trailing confidence tag



29
30
31
# File 'lib/rails_ai_bridge/tools/confidence_tag.rb', line 29

def tagged(text, source)
  "#{text} #{tag(source)}"
end