Class: Legion::LLM::Pipeline::Executor
- Inherits:
-
Object
- Object
- Legion::LLM::Pipeline::Executor
- Includes:
- Steps::Billing, Steps::Classification, Steps::ConfidenceScoring, Steps::Debate, Steps::GaiaAdvisory, Steps::KnowledgeCapture, Steps::Metering, Steps::PostResponse, Steps::PromptCache, Steps::RagContext, Steps::Rbac, Steps::SkillInjector, Steps::TokenBudget, Steps::ToolCalls, Steps::ToolDiscovery, Steps::TriggerMatch, Legion::Logging::Helper
- Defined in:
- lib/legion/llm/pipeline/executor.rb
Constant Summary collapse
- STEPS =
%i[ tracing_init idempotency conversation_uuid context_load rbac classification billing gaia_advisory tier_assignment rag_context trigger_match skill_injector tool_discovery routing request_normalization token_budget provider_call response_normalization metering debate confidence_scoring tool_calls context_store post_response knowledge_capture response_return ].freeze
- PRE_PROVIDER_STEPS =
%i[ tracing_init idempotency conversation_uuid context_load rbac classification billing gaia_advisory tier_assignment rag_context trigger_match skill_injector tool_discovery routing request_normalization token_budget ].freeze
- POST_PROVIDER_STEPS =
%i[ response_normalization metering debate confidence_scoring tool_calls context_store post_response knowledge_capture response_return ].freeze
- ASYNC_SAFE_STEPS =
%i[post_response knowledge_capture response_return].freeze
- MAX_RUBY_LLM_TOOL_ROUNDS =
200- ASYNC_THREAD_POOL =
Concurrent::FixedThreadPool.new(4, fallback_policy: :caller_runs)
Constants included from Steps::Debate
Steps::Debate::CHALLENGER_PROMPT, Steps::Debate::JUDGE_PROMPT, Steps::Debate::REBUTTAL_PROMPT
Constants included from Steps::ToolCalls
Steps::ToolCalls::MAX_TOOL_LOOPS
Constants included from Steps::Classification
Steps::Classification::LEVELS, Steps::Classification::PHI_KEYWORDS, Steps::Classification::PII_PATTERNS
Instance Attribute Summary collapse
-
#audit ⇒ Object
readonly
Returns the value of attribute audit.
-
#confidence_score ⇒ Object
readonly
Returns the value of attribute confidence_score.
-
#discovered_tools ⇒ Object
readonly
Returns the value of attribute discovered_tools.
-
#enrichments ⇒ Object
readonly
Returns the value of attribute enrichments.
-
#escalation_chain ⇒ Object
readonly
Returns the value of attribute escalation_chain.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#timeline ⇒ Object
readonly
Returns the value of attribute timeline.
-
#tool_event_handler ⇒ Object
Returns the value of attribute tool_event_handler.
-
#tracing ⇒ Object
readonly
Returns the value of attribute tracing.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #call ⇒ Object
- #call_stream(&block) ⇒ Object
-
#initialize(request) ⇒ Executor
constructor
A new instance of Executor.
Methods included from Steps::Metering
build_event, flush_spool, identity_fields, publish_event, publish_or_spool, timing_and_context, token_fields
Methods included from Steps::Debate
#debate_enabled?, #gaia_debate_trigger?, #run_debate, #step_debate
Methods included from Steps::PromptCache
#apply_cache_control, #apply_conversation_breakpoint, #sort_tools_deterministically
Methods included from Steps::TokenBudget
Methods included from Steps::ConfidenceScoring
Methods included from Steps::KnowledgeCapture
Methods included from Steps::ToolCalls
Methods included from Steps::ToolDiscovery
Methods included from Steps::SkillInjector
Methods included from Steps::TriggerMatch
Methods included from Steps::RagContext
Methods included from Steps::PostResponse
Methods included from Steps::GaiaAdvisory
#build_partner_context, #step_gaia_advisory
Methods included from Steps::Billing
Methods included from Steps::Classification
Methods included from Steps::Rbac
Constructor Details
#initialize(request) ⇒ Executor
Returns a new instance of Executor.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/legion/llm/pipeline/executor.rb', line 56 def initialize(request) @request = request @profile = Profile.derive(request.caller) @timeline = Timeline.new @tracing = nil @enrichments = {} @audit = {} @warnings = [] @timestamps = { received: Time.now } @raw_response = nil @exchange_id = nil @discovered_tools = [] @triggered_tools = [] @resolved_provider = nil @resolved_model = nil @confidence_score = nil @escalation_chain = nil @escalation_history = [] @proactive_tier_assignment = nil @tool_event_handler = nil end |
Instance Attribute Details
#audit ⇒ Object (readonly)
Returns the value of attribute audit.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def audit @audit end |
#confidence_score ⇒ Object (readonly)
Returns the value of attribute confidence_score.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def confidence_score @confidence_score end |
#discovered_tools ⇒ Object (readonly)
Returns the value of attribute discovered_tools.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def discovered_tools @discovered_tools end |
#enrichments ⇒ Object (readonly)
Returns the value of attribute enrichments.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def enrichments @enrichments end |
#escalation_chain ⇒ Object (readonly)
Returns the value of attribute escalation_chain.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def escalation_chain @escalation_chain end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def profile @profile end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def request @request end |
#timeline ⇒ Object (readonly)
Returns the value of attribute timeline.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def timeline @timeline end |
#tool_event_handler ⇒ Object
Returns the value of attribute tool_event_handler.
20 21 22 |
# File 'lib/legion/llm/pipeline/executor.rb', line 20 def tool_event_handler @tool_event_handler end |
#tracing ⇒ Object (readonly)
Returns the value of attribute tracing.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def tracing @tracing end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
17 18 19 |
# File 'lib/legion/llm/pipeline/executor.rb', line 17 def warnings @warnings end |
Instance Method Details
#call ⇒ Object
78 79 80 81 |
# File 'lib/legion/llm/pipeline/executor.rb', line 78 def call execute_steps build_response end |
#call_stream(&block) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/legion/llm/pipeline/executor.rb', line 83 def call_stream(&block) return call unless block execute_pre_provider_steps step_provider_call_stream(&block) execute_post_provider_steps build_response end |