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 +4 -4
- data/CHANGES.md +16 -0
- data/bin/ollama_cli +3 -1
- data/lib/ollama/message.rb +5 -3
- data/lib/ollama/version.rb +1 -1
- data/ollama-ruby.gemspec +2 -2
- data/spec/ollama/message_spec.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b6a67a947af787d3a67180531d7afb1390a009adf38616b55f32bc6c9301942
|
4
|
+
data.tar.gz: e7fb09439a06ede0a240f42f64048e88ac2d295fa50a8d3bc59dfed3bdb98b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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
|
|
data/lib/ollama/message.rb
CHANGED
@@ -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, @
|
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
|
data/lib/ollama/version.rb
CHANGED
data/ollama-ruby.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: ollama-ruby 1.1
|
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
|
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]
|
data/spec/ollama/message_spec.rb
CHANGED
@@ -7,9 +7,10 @@ RSpec.describe Ollama::Message do
|
|
7
7
|
|
8
8
|
let :message do
|
9
9
|
described_class.new(
|
10
|
-
role:
|
10
|
+
role: 'user',
|
11
11
|
content: 'hello world',
|
12
|
-
|
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
|
|