Class: Ollama::Commands::Create
- Inherits:
-
Object
- Object
- Ollama::Commands::Create
- Includes:
- DTO
- Defined in:
- lib/ollama/commands/create.rb
Instance Attribute Summary collapse
-
#adapters ⇒ Object
readonly
Returns the value of attribute adapters.
-
#client ⇒ Object
writeonly
Sets the attribute client.
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#license ⇒ Object
readonly
Returns the value of attribute license.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#quantize ⇒ Object
readonly
Returns the value of attribute quantize.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
-
#system ⇒ Object
readonly
Returns the value of attribute system.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model:, from: nil, files: nil, adapters: nil, template: nil, license: nil, system: nil, parameters: nil, messages: nil, stream: true, quantize: nil) ⇒ Create
constructor
A new instance of Create.
- #perform(handler) ⇒ Object
Methods included from DTO
#==, #as_array, #as_array_of_hashes, #as_hash, #as_json, #empty?, #to_json
Constructor Details
#initialize(model:, from: nil, files: nil, adapters: nil, template: nil, license: nil, system: nil, parameters: nil, messages: nil, stream: true, quantize: nil) ⇒ Create
Returns a new instance of Create.
8 9 10 11 12 |
# File 'lib/ollama/commands/create.rb', line 8 def initialize(model:, from: nil, files: nil, adapters: nil, template: nil, license: nil, system: nil, parameters: nil, messages: nil, stream: true, quantize: nil) @model, @from, @files, @adapters, @license, @system, @parameters, , @stream, @quantize = model, from, as_hash(files), as_hash(adapters), as_array(license), system, as_hash(parameters), as_array_of_hashes(), stream, quantize end |
Instance Attribute Details
#adapters ⇒ Object (readonly)
Returns the value of attribute adapters.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def adapters @adapters end |
#client=(value) ⇒ Object (writeonly)
Sets the attribute client
16 17 18 |
# File 'lib/ollama/commands/create.rb', line 16 def client=(value) @client = value end |
#files ⇒ Object (readonly)
Returns the value of attribute files.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def files @files end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def from @from end |
#license ⇒ Object (readonly)
Returns the value of attribute license.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def license @license end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def model @model end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def parameters @parameters end |
#quantize ⇒ Object (readonly)
Returns the value of attribute quantize.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def quantize @quantize end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def stream @stream end |
#system ⇒ Object (readonly)
Returns the value of attribute system.
14 15 16 |
# File 'lib/ollama/commands/create.rb', line 14 def system @system end |
Class Method Details
.path ⇒ Object
4 5 6 |
# File 'lib/ollama/commands/create.rb', line 4 def self.path '/api/create' end |
Instance Method Details
#perform(handler) ⇒ Object
18 19 20 |
# File 'lib/ollama/commands/create.rb', line 18 def perform(handler) @client.request(method: :post, path: self.class.path, body: to_json, stream:, handler:) end |