ollama-ruby 1.1.0 → 1.2.1

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: dc9d143d1e8c579098ebceb971e448266da56836249e48bbaa54fd484801227e
4
- data.tar.gz: 54ca7b0e5d6e9aae5555baf224444d05d674d1a0f9723d8c8ced60c9dd9885ad
3
+ metadata.gz: 0b6a67a947af787d3a67180531d7afb1390a009adf38616b55f32bc6c9301942
4
+ data.tar.gz: e7fb09439a06ede0a240f42f64048e88ac2d295fa50a8d3bc59dfed3bdb98b3a
5
5
  SHA512:
6
- metadata.gz: 8d38465b67b00c410ef8ade0116478b61ef148bb0f556e36910e9b0402ad6f3dba1720913f42f5785501f536adc8bf2d3c62cad5fb54578527a6c280bf3eaf30
7
- data.tar.gz: 07ff87834a7ad4983295a896260ee7210100c31bc2887bf6ab3732ec32c041d1d8fde0152c94dade0e4d12c4142b75b517aaebde2e214b784963b4cd6d191369
6
+ metadata.gz: acc5e14fca8df34795a2cca585ff56157023b14dbd53c10995bf1751a39d2f137dbb9c5a26bbb2c58dc7a2ac1402d56ceea37eaf744189a5fc191f3532a0e57b
7
+ data.tar.gz: b8f0357fa9734eed66dd7b9013df7f6e464d3a0af7bd00acd11552dfffb15951b18d12bd2ab7c2c45736a735f4ee4f9ae2900d96415cf30bf9ff6a401e4dd3f8
data/CHANGES.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-06-02 v1.2.1
4
+
5
+ * Added thinking mode option to CLI:
6
+ + `bin/ollama_cli` now includes `-T` flag for thinking mode generation
7
+
8
+ ## 2025-06-01 v1.2.0
9
+
10
+ * Added `tool_calls` parameter to the `initialize` method of the `Message` class:
11
+ * `def initialize(tool_calls: nil)`
12
+ * Updated instance variable assignment in the `initialize` method.
13
+ * Added `:thinking` reader attribute to the `Ollama::Message` class:
14
+ * `attr_reader :thinking`
15
+ * Updated `initialize` method in `Ollama::Message` to accept `thinking` option:
16
+ * `def initialize(thinking: false)`
17
+ * Updated spec tests for `Ollama::Message` with new attributes.
18
+
3
19
  ## 2025-06-01 v1.1.0
4
20
 
5
21
  * Added the `think` option to chat and generate commands:
data/bin/ollama_cli CHANGED
@@ -74,13 +74,14 @@ def usage
74
74
  -P VARIABLE sets prompt var %{foo} to "bar" if VARIABLE is foo=bar
75
75
  -H HANDLER the handler to use for the response, defaults to ChatStart
76
76
  -S use streaming for generation
77
+ -T use thinking for generation
77
78
  -h this help
78
79
 
79
80
  EOT
80
81
  exit 0
81
82
  end
82
83
 
83
- opts = go 'u:m:M:s:p:P:H:Sh', defaults: { ?H => 'ChatStart', ?M => '{}' }
84
+ opts = go 'u:m:M:s:p:P:H:STh', defaults: { ?H => 'ChatStart', ?M => '{}' }
84
85
 
85
86
  opts[?h] and usage
86
87
 
@@ -123,6 +124,7 @@ Client.new(base_url:, read_timeout: 120).generate(
123
124
  prompt:,
124
125
  options:,
125
126
  stream: !!opts[?S],
127
+ think: !!opts[?T],
126
128
  &handler
127
129
  )
128
130
 
@@ -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.1.0'
3
+ VERSION = '1.2.1'
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,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama-ruby 1.1.0 ruby lib
2
+ # stub: ollama-ruby 1.2.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama-ruby".freeze
6
- s.version = "1.1.0".freeze
6
+ s.version = "1.2.1".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]
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank