Class: Mistral::ClientBase
- Inherits:
-
Object
- Object
- Mistral::ClientBase
- Defined in:
- lib/mistral/client_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#max_retries ⇒ Object
readonly
Returns the value of attribute max_retries.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(endpoint:, api_key: nil, max_retries: 5, timeout: 120) ⇒ ClientBase
constructor
A new instance of ClientBase.
Constructor Details
#initialize(endpoint:, api_key: nil, max_retries: 5, timeout: 120) ⇒ ClientBase
Returns a new instance of ClientBase.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mistral/client_base.rb', line 7 def initialize(endpoint:, api_key: nil, max_retries: 5, timeout: 120) @max_retries = max_retries @timeout = timeout api_key = ENV['MISTRAL_API_KEY'] if api_key.nil? raise Error, 'API key not provided. Please set MISTRAL_API_KEY environment variable.' if api_key.nil? @api_key = api_key @endpoint = endpoint @logger = config_logger # For azure endpoints, we default to the mistral model @default_model = 'mistral' if endpoint.include?('inference.azure.com') end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/mistral/client_base.rb', line 5 def api_key @api_key end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/mistral/client_base.rb', line 5 def endpoint @endpoint end |
#max_retries ⇒ Object (readonly)
Returns the value of attribute max_retries.
5 6 7 |
# File 'lib/mistral/client_base.rb', line 5 def max_retries @max_retries end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/mistral/client_base.rb', line 5 def timeout @timeout end |