Class: Ollama::Commands::Embeddings
- Inherits:
-
Object
- Object
- Ollama::Commands::Embeddings
- Includes:
- DTO
- Defined in:
- lib/ollama/commands/embeddings.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
writeonly
Sets the attribute client.
-
#keep_alive ⇒ Object
readonly
Returns the value of attribute keep_alive.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model:, prompt:, options: nil, keep_alive: nil) ⇒ Embeddings
constructor
A new instance of Embeddings.
- #perform(handler) ⇒ Object
Methods included from DTO
#as_array_of_hashes, #as_json, #empty?, #to_json
Constructor Details
#initialize(model:, prompt:, options: nil, keep_alive: nil) ⇒ Embeddings
Returns a new instance of Embeddings.
8 9 10 11 |
# File 'lib/ollama/commands/embeddings.rb', line 8 def initialize(model:, prompt:, options: nil, keep_alive: nil) @model, @prompt, @options, @keep_alive, @stream = model, prompt, , keep_alive, false end |
Instance Attribute Details
#client=(value) ⇒ Object (writeonly)
Sets the attribute client
15 16 17 |
# File 'lib/ollama/commands/embeddings.rb', line 15 def client=(value) @client = value end |
#keep_alive ⇒ Object (readonly)
Returns the value of attribute keep_alive.
13 14 15 |
# File 'lib/ollama/commands/embeddings.rb', line 13 def keep_alive @keep_alive end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
13 14 15 |
# File 'lib/ollama/commands/embeddings.rb', line 13 def model @model end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/ollama/commands/embeddings.rb', line 13 def @options end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
13 14 15 |
# File 'lib/ollama/commands/embeddings.rb', line 13 def prompt @prompt end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
13 14 15 |
# File 'lib/ollama/commands/embeddings.rb', line 13 def stream @stream end |
Class Method Details
.path ⇒ Object
4 5 6 |
# File 'lib/ollama/commands/embeddings.rb', line 4 def self.path '/api/embeddings' end |
Instance Method Details
#perform(handler) ⇒ Object
17 18 19 |
# File 'lib/ollama/commands/embeddings.rb', line 17 def perform(handler) @client.request(method: :post, path: self.class.path, body: to_json, stream:, handler:) end |