Module: Legion::LLM::Pipeline::Profile

Defined in:
lib/legion/llm/pipeline/profile.rb

Constant Summary collapse

GAIA_SKIP =
%i[
  idempotency conversation_uuid context_load rbac classification
  billing gaia_advisory trigger_match skill_injector tool_discovery context_store post_response
].freeze
SYSTEM_SKIP =
%i[
  idempotency conversation_uuid context_load rbac classification
  billing gaia_advisory rag_context trigger_match skill_injector tool_discovery context_store
  post_response
].freeze
QUICK_REPLY_SKIP =
%i[
  idempotency conversation_uuid context_load classification
  gaia_advisory rag_context trigger_match skill_injector tool_discovery confidence_scoring
  tool_calls context_store post_response knowledge_capture
].freeze
HUMAN_SKIP =
%i[].freeze
SERVICE_SKIP =
%i[
  conversation_uuid context_load gaia_advisory
  rag_context trigger_match skill_injector tool_discovery confidence_scoring
  tool_calls context_store knowledge_capture
].freeze

Class Method Summary collapse

Class Method Details

.derive(caller_hash) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/legion/llm/pipeline/profile.rb', line 34

def derive(caller_hash)
  return :external if caller_hash.nil?

  requested_by = caller_hash[:requested_by] || {}
  type = requested_by[:type]&.to_sym
  identity = requested_by[:identity].to_s

  return :quick_reply if type == :quick_reply
  return :human       if %i[human user].include?(type)
  return :service     if type == :service
  return :external    unless type == :system

  identity.start_with?('gaia:') ? :gaia : :system
end

.skip?(profile, step) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
53
54
55
56
57
58
# File 'lib/legion/llm/pipeline/profile.rb', line 49

def skip?(profile, step)
  case profile
  when :gaia        then GAIA_SKIP.include?(step)
  when :system      then SYSTEM_SKIP.include?(step)
  when :quick_reply then QUICK_REPLY_SKIP.include?(step)
  when :human       then HUMAN_SKIP.include?(step)
  when :service     then SERVICE_SKIP.include?(step)
  else false
  end
end