Class: Ollama::Commands::Create

Inherits:
Object
  • Object
show all
Includes:
DTO
Defined in:
lib/ollama/commands/create.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, @messages, @stream, @quantize =
    model, from, as_hash(files), as_hash(adapters), as_array(license), system,
    as_hash(parameters), as_array_of_hashes(messages), stream, quantize
end

Instance Attribute Details

#adaptersObject (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

Parameters:

  • value

    the value to set the attribute client to.



16
17
18
# File 'lib/ollama/commands/create.rb', line 16

def client=(value)
  @client = value
end

#filesObject (readonly)

Returns the value of attribute files.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def files
  @files
end

#fromObject (readonly)

Returns the value of attribute from.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def from
  @from
end

#licenseObject (readonly)

Returns the value of attribute license.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def license
  @license
end

#messagesObject (readonly)

Returns the value of attribute messages.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def messages
  @messages
end

#modelObject (readonly)

Returns the value of attribute model.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def model
  @model
end

#parametersObject (readonly)

Returns the value of attribute parameters.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def parameters
  @parameters
end

#quantizeObject (readonly)

Returns the value of attribute quantize.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def quantize
  @quantize
end

#streamObject (readonly)

Returns the value of attribute stream.



14
15
16
# File 'lib/ollama/commands/create.rb', line 14

def stream
  @stream
end

#systemObject (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

.pathObject



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