Class: Legion::LLM::Transport::Message
- Inherits:
-
Transport::Message
- Object
- Transport::Message
- Legion::LLM::Transport::Message
show all
- Defined in:
- lib/legion/llm/transport/message.rb
Constant Summary
collapse
- LLM_ENVELOPE_KEYS =
Keys stripped from the JSON body (in addition to base ENVELOPE_KEYS). Do NOT add keys already in ENVELOPE_KEYS (:routing_key, :reply_to, etc.). Do NOT add :request_type — metering/audit need it in the body. Do NOT add :message_context — it MUST appear in the body of all 6 messages.
%i[
fleet_correlation_id provider model ttl
].freeze
Instance Method Summary
collapse
Instance Method Details
#app_id ⇒ Object
35
36
37
|
# File 'lib/legion/llm/transport/message.rb', line 35
def app_id
@options[:app_id] || 'legion-llm'
end
|
#correlation_id ⇒ Object
Fleet messages use :fleet_correlation_id to avoid collision with the base class’s :correlation_id (which falls through to :parent_id/:task_id).
31
32
33
|
# File 'lib/legion/llm/transport/message.rb', line 31
def correlation_id
@options[:fleet_correlation_id] || super
end
|
39
40
41
|
# File 'lib/legion/llm/transport/message.rb', line 39
def
super.merge().merge().merge()
end
|
#message ⇒ Object
21
22
23
|
# File 'lib/legion/llm/transport/message.rb', line 21
def message
@options.except(*ENVELOPE_KEYS, *LLM_ENVELOPE_KEYS)
end
|
#message_context ⇒ Object
17
18
19
|
# File 'lib/legion/llm/transport/message.rb', line 17
def message_context
@options[:message_context] || {}
end
|
#message_id ⇒ Object
25
26
27
|
# File 'lib/legion/llm/transport/message.rb', line 25
def message_id
@options[:message_id] || "#{message_id_prefix}_#{SecureRandom.uuid}"
end
|
Subclasses override to inject OpenTelemetry span context. Stub returns empty hash until tracing integration is implemented.
45
46
47
|
# File 'lib/legion/llm/transport/message.rb', line 45
def
{}
end
|