Class: Legion::Extensions::Llm::Transport::Messages::FleetResponse
- Inherits:
-
Transport::Message
- Object
- Transport::Message
- Legion::Extensions::Llm::Transport::Messages::FleetResponse
- Defined in:
- lib/legion/extensions/llm/transport/messages/fleet_response.rb
Overview
Correlated protocol-v2 response envelope for fleet reply queues.
Constant Summary
Constants included from Fleet::EnvelopeValidation
Fleet::EnvelopeValidation::LEGACY_OPTIONS
Constants included from Fleet::DefaultExchangeReply
Fleet::DefaultExchangeReply::DEFAULT_REPLY_PUBLISH_OPTIONS
Instance Method Summary collapse
- #app_id ⇒ Object
- #correlation_id ⇒ Object
- #message ⇒ Object
- #message_id ⇒ Object
- #reply_to ⇒ Object
- #routing_key ⇒ Object
- #type ⇒ Object
- #validate ⇒ Object
Methods included from Fleet::DefaultExchangeReply
Instance Method Details
#app_id ⇒ Object
20 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 20 def app_id = @options[:app_id] || 'lex-llm' |
#correlation_id ⇒ Object
22 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 22 def correlation_id = @options[:correlation_id] |
#message ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 38 def super.except(:thinking).merge( protocol_version: @options[:protocol_version] || Fleet::Protocol::VERSION, request_id: @options[:request_id], correlation_id: correlation_id, idempotency_key: @options[:idempotency_key], operation: @options[:operation], provider: @options[:provider], provider_instance: @options[:provider_instance] || @options[:instance], model: @options[:model], reply_to: reply_to, message_context: @options[:message_context], trace_context: @options[:trace_context], content: @options[:content], tool_calls: @options[:tool_calls], usage: @options[:usage] || {}, finish_reason: @options[:finish_reason], metadata: @options[:metadata] || {} ).compact end |
#message_id ⇒ Object
23 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 23 def = @options[:message_id] ||= "llm_fleet_res_#{SecureRandom.uuid}" |
#reply_to ⇒ Object
21 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 21 def reply_to = @options[:reply_to] |
#routing_key ⇒ Object
25 26 27 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 25 def routing_key @options[:reply_to] || raise(ArgumentError, 'reply_to is required') end |
#type ⇒ Object
19 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 19 def type = Fleet::Protocol::RESPONSE_TYPE |
#validate ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 29 def validate require_option!(:request_id) require_option!(:correlation_id) require_option!(:reply_to) require_protocol_version! @valid = true end |