Class: LaunchDarkly::Server::AI::AIConfigDefault
- Inherits:
-
Object
- Object
- LaunchDarkly::Server::AI::AIConfigDefault
- Defined in:
- lib/server/ai/client.rb
Overview
The AIConfigDefault class represents a user-provided fallback AI configuration.
Pass an instance of this class as the default: parameter to Client#completion_config to control the fallback values when a flag is not found or cannot be evaluated.
This is an input-only type: it is what an application supplies to the SDK, never what the SDK returns. The SDK always returns an AIConfig, which carries a tracker factory; AIConfigDefault does not.
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
-
.disabled ⇒ AIConfigDefault
Returns a new AIConfigDefault with enabled: false and no model, messages, or provider.
Instance Method Summary collapse
-
#initialize(enabled: false, model: nil, messages: nil, provider: nil) ⇒ AIConfigDefault
constructor
A new instance of AIConfigDefault.
- #to_h ⇒ Object
Constructor Details
#initialize(enabled: false, model: nil, messages: nil, provider: nil) ⇒ AIConfigDefault
Returns a new instance of AIConfigDefault.
128 129 130 131 132 133 |
# File 'lib/server/ai/client.rb', line 128 def initialize(enabled: false, model: nil, messages: nil, provider: nil) @enabled = enabled @messages = @model = model @provider = provider end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
116 117 118 |
# File 'lib/server/ai/client.rb', line 116 def enabled @enabled end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
116 117 118 |
# File 'lib/server/ai/client.rb', line 116 def @messages end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
116 117 118 |
# File 'lib/server/ai/client.rb', line 116 def model @model end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
116 117 118 |
# File 'lib/server/ai/client.rb', line 116 def provider @provider end |
Class Method Details
.disabled ⇒ AIConfigDefault
Returns a new AIConfigDefault with enabled: false and no model, messages, or provider.
124 125 126 |
# File 'lib/server/ai/client.rb', line 124 def self.disabled new(enabled: false) end |
Instance Method Details
#to_h ⇒ Object
135 136 137 138 139 140 141 142 143 144 |
# File 'lib/server/ai/client.rb', line 135 def to_h { _ldMeta: { enabled: @enabled || false, }, messages: @messages.is_a?(Array) ? @messages.map { |msg| msg&.to_h } : nil, model: @model&.to_h, provider: @provider&.to_h, } end |