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 sticky_runners skill_injector tool_history_inject
  tool_discovery context_store post_response sticky_persist
].freeze
SYSTEM_SKIP =
%i[
  idempotency conversation_uuid context_load rbac classification
  billing gaia_advisory rag_context trigger_match sticky_runners skill_injector
  tool_history_inject tool_discovery context_store post_response sticky_persist
].freeze
QUICK_REPLY_SKIP =
%i[
  idempotency conversation_uuid context_load classification
  gaia_advisory rag_context trigger_match sticky_runners skill_injector
  tool_history_inject tool_discovery confidence_scoring
  tool_calls sticky_persist context_store post_response knowledge_capture
].freeze
HUMAN_SKIP =
%i[].freeze
SERVICE_SKIP =
%i[
  conversation_uuid context_load gaia_advisory
  rag_context trigger_match sticky_runners skill_injector tool_history_inject
  tool_discovery confidence_scoring
  tool_calls sticky_persist context_store knowledge_capture
].freeze

Class Method Summary collapse

Class Method Details

.derive(caller_hash) ⇒ Object



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

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)


52
53
54
55
56
57
58
59
60
61
# File 'lib/legion/llm/pipeline/profile.rb', line 52

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