Class: Ollama::Client::Configuration::Config
- Inherits:
-
Object
- Object
- Ollama::Client::Configuration::Config
- Extended by:
- JSONLoader
- Defined in:
- lib/ollama/client/configuration/config.rb
Overview
A class that encapsulates configuration settings for Ollama clients.
This class provides a structured way to define and manage various configuration options that can be used when initializing Ollama client instances. It includes properties for setting the base URL, output stream, and timeout values.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
The base_url attribute accessor allows reading and setting the base URL of the Ollama API endpoint.
-
#connect_timeout ⇒ Object
The connect_timeout attribute accessor allows reading and setting the connection timeout value.
-
#debug ⇒ Object
The debug attribute accessor allows reading and setting the debug flag.
-
#output ⇒ Object
The output attribute accessor allows reading and setting the output stream used for handling responses and messages.
-
#read_timeout ⇒ Object
The read_timeout attribute accessor allows reading and setting the read timeout value.
-
#user_agent ⇒ Object
The user_agent attribute accessor allows reading and setting the user agent string used for making requests to the Ollama API.
-
#write_timeout ⇒ Object
The write_timeout attribute accessor allows reading and setting the write timeout value.
Class Method Summary collapse
-
.[](value) ⇒ self
The [] method creates a new instance of the class using a hash of attributes.
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ Ollama::Client::Configuration::Config
constructor
The initialize method sets up a new configuration instance with the specified attributes.
Methods included from JSONLoader
Constructor Details
#initialize(**attributes) ⇒ Ollama::Client::Configuration::Config
The initialize method sets up a new configuration instance with the specified attributes.
This method is responsible for initializing a new Ollama::Client::Configuration::Config instance by processing various configuration options. It iterates through the provided attributes and assigns them to corresponding setter methods, then ensures that the output stream is set to $stdout if no output was specified.
54 55 56 57 |
# File 'lib/ollama/client/configuration/config.rb', line 54 def initialize(**attributes) attributes.each { |k, v| send("#{k}=", v) } self.output ||= $stdout end |
Instance Attribute Details
#base_url ⇒ Object
The base_url attribute accessor allows reading and setting the base URL of the Ollama API endpoint.
79 80 81 |
# File 'lib/ollama/client/configuration/config.rb', line 79 def base_url @base_url end |
#connect_timeout ⇒ Object
The connect_timeout attribute accessor allows reading and setting the connection timeout value.
91 92 93 |
# File 'lib/ollama/client/configuration/config.rb', line 91 def connect_timeout @connect_timeout end |
#debug ⇒ Object
The debug attribute accessor allows reading and setting the debug flag.
108 109 110 |
# File 'lib/ollama/client/configuration/config.rb', line 108 def debug @debug end |
#output ⇒ Object
The output attribute accessor allows reading and setting the output stream used for handling responses and messages.
85 86 87 |
# File 'lib/ollama/client/configuration/config.rb', line 85 def output @output end |
#read_timeout ⇒ Object
The read_timeout attribute accessor allows reading and setting the read timeout value.
97 98 99 |
# File 'lib/ollama/client/configuration/config.rb', line 97 def read_timeout @read_timeout end |
#user_agent ⇒ Object
The user_agent attribute accessor allows reading and setting the user agent string used for making requests to the Ollama API.
114 115 116 |
# File 'lib/ollama/client/configuration/config.rb', line 114 def user_agent @user_agent end |
#write_timeout ⇒ Object
The write_timeout attribute accessor allows reading and setting the write timeout value.
103 104 105 |
# File 'lib/ollama/client/configuration/config.rb', line 103 def write_timeout @write_timeout end |
Class Method Details
.[](value) ⇒ self
The [] method creates a new instance of the class using a hash of attributes.
This class method provides a convenient way to instantiate an object by passing a hash containing the desired attribute values. It converts the hash keys to symbols and forwards them as keyword arguments to the constructor.
attributes
71 72 73 |
# File 'lib/ollama/client/configuration/config.rb', line 71 def self.[](value) new(**value.to_h) end |