ollama-ruby 1.12.0 → 1.14.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 +4 -4
- data/CHANGES.md +19 -0
- data/lib/ollama/image.rb +11 -1
- data/lib/ollama/version.rb +1 -1
- data/ollama-ruby.gemspec +2 -2
- data/spec/ollama/image_spec.rb +6 -2
- data/spec/ollama/message_spec.rb +1 -1
- 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: d07a44fbcf79c2fcab881a2e2f2bcbcd42c18d040498e7988abb77e3aa97a6f5
|
|
4
|
+
data.tar.gz: 4ab66fbf6953ca66c3235eb9512ce38b53371d5f2178603ff678d94b30fa9551
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08433690e167532e8a98c81b212cb6a82a96329121f376379c56abf5ecfae2e7e11d96ba40875357b6a83796fe018db4b9a3b5148711860400cdbbe290c0e2c1'
|
|
7
|
+
data.tar.gz: bdf0161b3c9ba895ff79927bcd515f346c1582cebddc86f14d7077a16ad39c907a406d1db8a056ac0a7d1f19bdaf58468cbb4acab56d5618112fe875199da540
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2025-12-03 v1.14.0
|
|
4
|
+
|
|
5
|
+
- Added `as_json` method to `Ollama::Image` class that returns base64 string
|
|
6
|
+
for Ollama API compatibility
|
|
7
|
+
- Added test case verifying `image.to_json` produces quoted base64 string
|
|
8
|
+
- Method signature uses `*_args` to accept ignored parameters for JSON
|
|
9
|
+
compatibility
|
|
10
|
+
- Documented method behavior for JSON serialization compatibility
|
|
11
|
+
|
|
12
|
+
## 2025-12-03 v1.13.0
|
|
13
|
+
|
|
14
|
+
- Updated `Ollama::Image#for_string` method to use `Base64.strict_encode64` for
|
|
15
|
+
image encoding
|
|
16
|
+
- Modified test expectations in `image_spec.rb` with new size **132196** and
|
|
17
|
+
checksum **20420**
|
|
18
|
+
- Updated `message_spec.rb` JSON payload to remove trailing newline from image
|
|
19
|
+
data
|
|
20
|
+
- Enhanced base64 encoding strictness for image handling in Ollama library
|
|
21
|
+
|
|
3
22
|
## 2025-11-30 v1.12.0
|
|
4
23
|
|
|
5
24
|
- `ollama_cli`
|
data/lib/ollama/image.rb
CHANGED
|
@@ -59,7 +59,7 @@ class Ollama::Image
|
|
|
59
59
|
# @return [ Ollama::Image ] a new Image instance initialized with the
|
|
60
60
|
# encoded string data and optional path
|
|
61
61
|
def for_string(string, path: nil)
|
|
62
|
-
for_base64(Base64.
|
|
62
|
+
for_base64(Base64.strict_encode64(string), path:)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
# Creates a new Image object from an IO object by reading its contents and
|
|
@@ -106,4 +106,14 @@ class Ollama::Image
|
|
|
106
106
|
def to_s
|
|
107
107
|
@data
|
|
108
108
|
end
|
|
109
|
+
|
|
110
|
+
# Returns the base64-encoded string representation of the image data.
|
|
111
|
+
# When this object is serialized to JSON, it will produce a quoted base64
|
|
112
|
+
# string as required by the Ollama API.
|
|
113
|
+
#
|
|
114
|
+
# @param _args [Array] ignored arguments (for compatibility with JSON serialization)
|
|
115
|
+
# @return [String] the base64-encoded image data
|
|
116
|
+
def as_json(*_args)
|
|
117
|
+
to_s
|
|
118
|
+
end
|
|
109
119
|
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.
|
|
2
|
+
# stub: ollama-ruby 1.14.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "ollama-ruby".freeze
|
|
6
|
-
s.version = "1.
|
|
6
|
+
s.version = "1.14.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]
|
data/spec/ollama/image_spec.rb
CHANGED
|
@@ -21,12 +21,16 @@ describe Ollama::Image do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'can be converted to base64 string' do
|
|
24
|
-
expect(image.to_s.size).to eq
|
|
25
|
-
expect(image.to_s.sum).to eq
|
|
24
|
+
expect(image.to_s.size).to eq 132196
|
|
25
|
+
expect(image.to_s.sum).to eq 20420
|
|
26
26
|
expect(image.to_s[0, 40]).to eq '/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAA'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it 'tracks path of file' do
|
|
30
30
|
expect(image.path).to eq asset('kitten.jpg')
|
|
31
31
|
end
|
|
32
|
+
|
|
33
|
+
it 'can be converted into JSON as a quoted base64 string' do
|
|
34
|
+
expect(image.to_json).to eq '"%s"' % image.to_s
|
|
35
|
+
end
|
|
32
36
|
end
|
data/spec/ollama/message_spec.rb
CHANGED
|
@@ -26,7 +26,7 @@ describe Ollama::Message do
|
|
|
26
26
|
images: [ image ],
|
|
27
27
|
)
|
|
28
28
|
expect(message.to_json).to eq(
|
|
29
|
-
'{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA
|
|
29
|
+
'{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA=="]}'
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
32
|
|