ollama-ruby 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b75645170e207cb661e3b98fed0754610a8807012715343c674206a66b0b72a
4
- data.tar.gz: 64617fa5bc78f5658db02ea7ae61dee6c537924951de022f2aaddda9ae933131
3
+ metadata.gz: b77be573fc0b5bf72e9d46c5ff580454cc5a0fe08a77b95cc607f532b06902c3
4
+ data.tar.gz: 9f8fa137acbac201e5fbf615c791258babeac6185f7656ba14574efa9020fc14
5
5
  SHA512:
6
- metadata.gz: 9e2968fca36a1c4345c0f948d12252d3f501186f24f5c433d824dd2cd8cfda8afeb65d7073655cca1f74ef2ff4f14546747ebf08f15cf842c2065a33e714d953
7
- data.tar.gz: f09c3d81093347f898af01386a2f84bd9a97e99b6c7e33e41eaf3eb3261815107ac12723ba4fb00e7180203396c95f0e20f55b3cbbc65dc5d3c5e0dc92753ffe
6
+ metadata.gz: 0f589bf0e5db1f682eae38fe481541c58e843c3511960b8d5bd659a0249661baf975b617b0d47768d33fe2fe7555ce71688bf904b0a2a9a2d7d2bfe06a6bb569
7
+ data.tar.gz: 1257d170eaff46b79838861638860c2ddb491bd7ca9d833fba92c841a4c6e366e70eb234bd7f7ebeeb4542ce98748c414eb58f59aca1151bed148ed16f6c2432
data/CHANGES.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-06-01 v1.2.0
4
+
5
+ * Added `tool_calls` parameter to the `initialize` method of the `Message` class:
6
+ * `def initialize(tool_calls: nil)`
7
+ * Updated instance variable assignment in the `initialize` method.
8
+ * Added `:thinking` reader attribute to the `Ollama::Message` class:
9
+ * `attr_reader :thinking`
10
+ * Updated `initialize` method in `Ollama::Message` to accept `thinking` option:
11
+ * `def initialize(thinking: false)`
12
+ * Updated spec tests for `Ollama::Message` with new attributes.
13
+
14
+ ## 2025-06-01 v1.1.0
15
+
16
+ * Added the `think` option to chat and generate commands:
17
+ * Added `think` parameter to `initialize` method in `lib/ollama/commands/chat.rb`
18
+ * Added `think` attribute reader and writer to `lib/ollama/commands/chat.rb`
19
+ * Added `think` parameter to `initialize` method in `lib/ollama/commands/generate.rb`
20
+ * Added `think` attribute reader to `lib/ollama/commands/generate.rb`
21
+
3
22
  ## 2025-04-15 v1.0.0
4
23
 
5
24
  **Use model parameter and support new create parameters**
@@ -5,13 +5,13 @@ class Ollama::Commands::Chat
5
5
  '/api/chat'
6
6
  end
7
7
 
8
- def initialize(model:, messages:, tools: nil, format: nil, options: nil, stream: nil, keep_alive: nil)
9
- @model, @messages, @tools, @format, @options, @stream, @keep_alive =
8
+ def initialize(model:, messages:, tools: nil, format: nil, options: nil, stream: nil, keep_alive: nil, think: nil)
9
+ @model, @messages, @tools, @format, @options, @stream, @keep_alive, @think =
10
10
  model, as_array_of_hashes(messages), as_array_of_hashes(tools),
11
- format, options, stream, keep_alive
11
+ format, options, stream, keep_alive, think
12
12
  end
13
13
 
14
- attr_reader :model, :messages, :tools, :format, :options, :stream, :keep_alive
14
+ attr_reader :model, :messages, :tools, :format, :options, :stream, :keep_alive, :think
15
15
 
16
16
  attr_writer :client
17
17
 
@@ -5,13 +5,13 @@ class Ollama::Commands::Generate
5
5
  '/api/generate'
6
6
  end
7
7
 
8
- def initialize(model:, prompt:, suffix: nil, images: nil, format: nil, options: nil, system: nil, template: nil, context: nil, stream: nil, raw: nil, keep_alive: nil)
9
- @model, @prompt, @suffix, @images, @format, @options, @system, @template, @context, @stream, @raw, @keep_alive =
10
- model, prompt, suffix, (Array(images) if images), format, options, system, template, context, stream, raw, keep_alive
8
+ def initialize(model:, prompt:, suffix: nil, images: nil, format: nil, options: nil, system: nil, template: nil, context: nil, stream: nil, raw: nil, keep_alive: nil, think: nil)
9
+ @model, @prompt, @suffix, @images, @format, @options, @system, @template, @context, @stream, @raw, @keep_alive, @think =
10
+ model, prompt, suffix, (Array(images) if images), format, options, system, template, context, stream, raw, keep_alive, think
11
11
  end
12
12
 
13
13
  attr_reader :model, :prompt, :suffix, :images, :format, :options, :system,
14
- :template, :context, :stream, :raw, :keep_alive
14
+ :template, :context, :stream, :raw, :keep_alive, :think
15
15
 
16
16
  attr_writer :client
17
17
 
@@ -1,9 +1,11 @@
1
1
  class Ollama::Message
2
2
  include Ollama::DTO
3
3
 
4
- attr_reader :role, :content, :images
4
+ attr_reader :role, :content, :thinking, :images
5
5
 
6
- def initialize(role:, content:, images: nil, **)
7
- @role, @content, @images = role, content, (Array(images) if images)
6
+ def initialize(role:, content:, thinking: nil, images: nil, tool_calls: nil, **)
7
+ @role, @content, @thinking, @images, @tool_calls =
8
+ role, content, thinking, (Array(images) if images),
9
+ (Array(tool_calls) if tool_calls)
8
10
  end
9
11
  end
@@ -1,6 +1,6 @@
1
1
  module Ollama
2
2
  # Ollama version
3
- VERSION = '1.0.0'
3
+ VERSION = '1.2.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/ollama-ruby.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama-ruby 1.0.0 ruby lib
2
+ # stub: ollama-ruby 1.2.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama-ruby".freeze
6
- s.version = "1.0.0".freeze
6
+ s.version = "1.2.0".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2025-04-14"
11
+ s.date = "1980-01-02"
12
12
  s.description = "Library that allows interacting with the Ollama API".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ollama_console".freeze, "ollama_update".freeze, "ollama_cli".freeze]
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "Ollama-ruby - Interacting with the Ollama API".freeze, "--main".freeze, "README.md".freeze]
20
20
  s.required_ruby_version = Gem::Requirement.new("~> 3.1".freeze)
21
- s.rubygems_version = "3.6.2".freeze
21
+ s.rubygems_version = "3.6.7".freeze
22
22
  s.summary = "Interacting with the Ollama API".freeze
23
23
  s.test_files = ["spec/ollama/client/doc_spec.rb".freeze, "spec/ollama/client_spec.rb".freeze, "spec/ollama/commands/chat_spec.rb".freeze, "spec/ollama/commands/copy_spec.rb".freeze, "spec/ollama/commands/create_spec.rb".freeze, "spec/ollama/commands/delete_spec.rb".freeze, "spec/ollama/commands/embed_spec.rb".freeze, "spec/ollama/commands/embeddings_spec.rb".freeze, "spec/ollama/commands/generate_spec.rb".freeze, "spec/ollama/commands/ps_spec.rb".freeze, "spec/ollama/commands/pull_spec.rb".freeze, "spec/ollama/commands/push_spec.rb".freeze, "spec/ollama/commands/show_spec.rb".freeze, "spec/ollama/commands/tags_spec.rb".freeze, "spec/ollama/commands/version_spec.rb".freeze, "spec/ollama/handlers/collector_spec.rb".freeze, "spec/ollama/handlers/dump_json_spec.rb".freeze, "spec/ollama/handlers/dump_yaml_spec.rb".freeze, "spec/ollama/handlers/markdown_spec.rb".freeze, "spec/ollama/handlers/nop_spec.rb".freeze, "spec/ollama/handlers/print_spec.rb".freeze, "spec/ollama/handlers/progress_spec.rb".freeze, "spec/ollama/handlers/say_spec.rb".freeze, "spec/ollama/handlers/single_spec.rb".freeze, "spec/ollama/image_spec.rb".freeze, "spec/ollama/message_spec.rb".freeze, "spec/ollama/options_spec.rb".freeze, "spec/ollama/tool_spec.rb".freeze, "spec/spec_helper.rb".freeze]
24
24
 
@@ -7,9 +7,10 @@ RSpec.describe Ollama::Message do
7
7
 
8
8
  let :message do
9
9
  described_class.new(
10
- role: 'user',
10
+ role: 'user',
11
11
  content: 'hello world',
12
- images: image
12
+ thinking: 'which world?',
13
+ images: image
13
14
  )
14
15
  end
15
16
 
@@ -21,16 +22,17 @@ RSpec.describe Ollama::Message do
21
22
  expect(message.as_json).to eq(
22
23
  role: 'user',
23
24
  content: 'hello world',
25
+ thinking: 'which world?',
24
26
  images: [ image ],
25
27
  )
26
28
  expect(message.to_json).to eq(
27
- '{"role":"user","content":"hello world","images":["dGVzdA==\n"]}'
29
+ '{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA==\n"]}'
28
30
  )
29
31
  end
30
32
 
31
33
  it 'can be restored from JSON' do
32
34
  expect(described_class.from_hash(JSON(<<~'end'))).to be_a described_class
33
- {"role":"user","content":"hello world","images":["dGVzdA==\n"]}
35
+ {"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA==\n"]}
34
36
  end
35
37
  end
36
38
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: gem_hadar
@@ -214,9 +214,9 @@ dependencies:
214
214
  description: Library that allows interacting with the Ollama API
215
215
  email: flori@ping.de
216
216
  executables:
217
+ - ollama_cli
217
218
  - ollama_console
218
219
  - ollama_update
219
- - ollama_cli
220
220
  extensions: []
221
221
  extra_rdoc_files:
222
222
  - README.md
@@ -362,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
362
  - !ruby/object:Gem::Version
363
363
  version: '0'
364
364
  requirements: []
365
- rubygems_version: 3.6.2
365
+ rubygems_version: 3.6.7
366
366
  specification_version: 4
367
367
  summary: Interacting with the Ollama API
368
368
  test_files: