Class: Legion::Extensions::Llm::Transport::Messages::FleetResponse

Inherits:
Transport::Message
  • Object
show all
Includes:
Fleet::DefaultExchangeReply, Fleet::EnvelopeValidation
Defined in:
lib/legion/extensions/llm/transport/messages/fleet_response.rb

Overview

Correlated protocol-v3 response envelope for fleet reply queues. E3: carries the serialized Canonical::Response under :response. E4: thinking exclusion happens exactly once at the responder (ProviderResponder#publish_response); this envelope is a pass-through. E5: no aliases — provider_instance only.

Constant Summary

Constants included from Fleet::DefaultExchangeReply

Fleet::DefaultExchangeReply::DEFAULT_REPLY_PUBLISH_OPTIONS

Instance Method Summary collapse

Methods included from Fleet::DefaultExchangeReply

#publish

Instance Method Details

#app_idObject



25
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 25

def app_id = @options[:app_id] || 'lex-llm'

#correlation_idObject



27
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 27

def correlation_id = @options[:correlation_id]

#encrypt?Boolean

Returns:

  • (Boolean)


24
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 24

def encrypt? = Fleet::Settings.value(:fleet, :compliance, :encrypt_fleet, default: true) == true

#messageObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 44

def message
  super.merge(
    protocol_version: @options[: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],
    model: @options[:model],
    reply_to: reply_to,
    message_context: @options[:message_context],
    trace_context: @options[:trace_context],
    response: @options[:response],
    execution_contract: @options[:execution_contract],
    offering_id: @options[:offering_id]
  ).compact
end

#message_idObject



28
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 28

def message_id = @options[:message_id] ||= "llm_fleet_res_#{SecureRandom.uuid}"

#reply_toObject



26
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 26

def reply_to = @options[:reply_to]

#routing_keyObject



30
31
32
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 30

def routing_key
  @options[:reply_to] || raise(ArgumentError, 'reply_to is required')
end

#typeObject



23
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 23

def type = Fleet::Protocol::RESPONSE_TYPE

#validateObject



34
35
36
37
38
39
40
41
42
# File 'lib/legion/extensions/llm/transport/messages/fleet_response.rb', line 34

def validate
  reject_legacy_options!
  require_option!(:request_id)
  require_option!(:correlation_id)
  require_option!(:reply_to)
  require_option!(:response)
  require_protocol_version!
  @valid = true
end