ollama-ruby 1.8.1 → 1.9.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: 88a823911175700e401b5b07a47b9b7c9b3303c781384fa5f99d51b1ebbc1822
4
- data.tar.gz: dfa6fc2fc22dcd0d89dbbaa2260238c11746682d53339b1cb059d679c013d38b
3
+ metadata.gz: 91ae1baa5bfbaca61fabd8b999527a323ba0ec345a62d7ba1d4fdd8a3f2afea0
4
+ data.tar.gz: d33bdaf8a42d9063acc125d90864fdf639e82a1362e51f731a85a3dd427bea60
5
5
  SHA512:
6
- metadata.gz: 0152e3bf64b1094852872cc3e58391d6e8464815d6377324eeddda4ed7f1b401727ae2c12db7a322e8eef6b54af67fde2bfacc49565cbe71480d2d1785c03976
7
- data.tar.gz: cd351d0b035f528f2fe16ec345424bdcbe084c2aa885809adb035fa37c4d6daab80b70e69c4b19ae40e8b2c7b628d91bc60feb06ff3cce432cd5009ad18e9521
6
+ metadata.gz: e604e07547c56818453993713847d6ce769f328f2872c652f37940c02983c41d56de5c630f0b735eee71c141753f28c51b9f6f8303a47e554ced93ab0c7164f3
7
+ data.tar.gz: ba902456a6f6a674668b9c8c97bf7d2f9d06beebac239fe908bc8456b6b4681a23da54447424d287fa926b7a1ef75779a496d37627cce77e09419e4e111997a6
data/CHANGES.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-10-20 v1.9.0
4
+
5
+ - Added `dimensions` parameter to `Ollama::Commands::Embed#initialize`
6
+ - Added `attr_reader :dimensions` for accessing the `dimensions` parameter
7
+ - Updated JSON serialization to include `dimensions` field
8
+ - Added specs for `dimensions` parameter instantiation and JSON conversion
9
+ - Parameter defaults to `nil` following same pattern as other optional params
10
+ - Supports truncating output embeddings to specified dimensions as per Ollama API
11
+ - Maintains backward compatibility with existing code
12
+ - Parameter type documented as `Integer, nil` in YARD comments
13
+ - Added new GitHub Actions workflow file `.github/workflows/static.yml`
14
+ - Configured workflow to deploy static content to GitHub Pages
15
+ - Set up Ruby environment with version **3.4** for documentation generation
16
+ - Added steps to install `gem_hadar`, run `bundle install`, and execute `rake doc`
17
+ - Updated `README.md` to include documentation link at
18
+ https://flori.github.io/ollama-ruby/
19
+ - Updated comment style guideline for `initialize` methods
20
+ - Skip `say` handler tests on non-macOS systems
21
+ - Add conditional check for `say` command availability using `File.executable?`
22
+ - Skip `Ollama::Handlers::Say` tests when `say` command is not found
23
+ - Use `skip: skip_reason` metadata to control test execution
24
+ - Update CI configuration
25
+ - Add `openssl-dev` and `ghostscript` dependencies to Dockerfile
26
+ - Change test command from `rake test` to `rake spec`
27
+ - Enable `fail_fast: true` in CI configuration
28
+ - Remove `rm -f Gemfile.lock` step from CI script
29
+ - Update `build-base` and `yaml-dev` apk packages in Dockerfile
30
+
3
31
  ## 2025-09-13 v1.8.1
4
32
 
5
33
  - Added `.yardopts` and `tmp` to `package_ignore` in `Rakefile`
data/README.md CHANGED
@@ -6,6 +6,10 @@ Ollama is a Ruby library gem that provides a client interface to interact with
6
6
  an ollama server via the
7
7
  [Ollama API](https://github.com/ollama/ollama/blob/main/docs/api.md).
8
8
 
9
+ ## Documentation
10
+
11
+ Complete API documentation is available at: [GitHub.io](https://flori.github.io/ollama-ruby/)
12
+
9
13
  ## Installation (gem & bundler)
10
14
 
11
15
  To install Ollama, you can use the following methods:
@@ -484,7 +488,7 @@ The homepage of this library is located at
484
488
 
485
489
  ## License
486
490
 
487
- This software is licensed under the <i>MIT</i> license.
491
+ This software is licensed under the [MIT License](./LICENSE).
488
492
 
489
493
  ---
490
494
 
data/Rakefile CHANGED
@@ -13,14 +13,17 @@ GemHadar do
13
13
  description 'Library that allows interacting with the Ollama API'
14
14
  test_dir 'spec'
15
15
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.AppleDouble', '.bundle',
16
- '.yardoc', 'doc', 'tags', 'errors.lst', 'cscope.out', 'coverage', 'tmp',
17
- 'yard'
16
+ '.yardoc', 'doc', 'tags', 'errors.lst', 'cscope.out', 'coverage', 'tmp'
18
17
  package_ignore '.all_images.yml', '.tool-versions', '.gitignore', 'VERSION',
19
18
  '.rspec', '.github', '.contexts', '.yardopts'
20
19
  readme 'README.md'
21
20
 
22
21
  executables << 'ollama_console' << 'ollama_update' << 'ollama_cli' << 'ollama_browse'
23
22
 
23
+ github_workflows(
24
+ 'static.yml' => {}
25
+ )
26
+
24
27
  required_ruby_version '~> 3.1'
25
28
 
26
29
  dependency 'excon', '~> 1.0'
@@ -36,9 +36,10 @@ class Ollama::Commands::Embed
36
36
  # @param options [ Ollama::Options, nil ] optional configuration parameters for the model
37
37
  # @param truncate [ Boolean, nil ] whether to truncate the input if it exceeds context length
38
38
  # @param keep_alive [ String, nil ] duration to keep the model loaded in memory
39
- def initialize(model:, input:, options: nil, truncate: nil, keep_alive: nil)
40
- @model, @input, @options, @truncate, @keep_alive =
41
- model, input, options, truncate, keep_alive
39
+ # @param dimensions [ Integer, nil ] truncates the output embedding to the specified dimension.
40
+ def initialize(model:, input:, options: nil, truncate: nil, keep_alive: nil, dimensions: nil)
41
+ @model, @input, @options, @truncate, @keep_alive, @dimensions =
42
+ model, input, options, truncate, keep_alive, dimensions
42
43
  @stream = false
43
44
  end
44
45
 
@@ -67,6 +68,12 @@ class Ollama::Commands::Embed
67
68
  # @return [ String, nil ] duration to keep the model loaded in memory
68
69
  attr_reader :keep_alive
69
70
 
71
+ # The dimensions attribute reader returns the dimensions associated with the
72
+ # object.
73
+ #
74
+ # @return [ Integer, nil ] the dimensions value stored in the instance variable
75
+ attr_reader :dimensions
76
+
70
77
  # The stream attribute reader returns the streaming behavior setting
71
78
  # associated with the object.
72
79
  #
@@ -74,7 +81,6 @@ class Ollama::Commands::Embed
74
81
  # streaming is enabled for the command execution (always false for embed commands)
75
82
  attr_reader :stream
76
83
 
77
-
78
84
  # The client attribute writer allows setting the client instance associated
79
85
  # with the object.
80
86
  #
@@ -1,6 +1,6 @@
1
1
  module Ollama
2
2
  # Ollama version
3
- VERSION = '1.8.1'
3
+ VERSION = '1.9.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,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama-ruby 1.8.1 ruby lib
2
+ # stub: ollama-ruby 1.9.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama-ruby".freeze
6
- s.version = "1.8.1".freeze
6
+ s.version = "1.9.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]
@@ -18,13 +18,13 @@ 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.9".freeze
21
+ s.rubygems_version = "3.7.2".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
 
25
25
  s.specification_version = 4
26
26
 
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.6".freeze])
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.8".freeze])
28
28
  s.add_development_dependency(%q<all_images>.freeze, ["~> 0.6".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.2".freeze])
30
30
  s.add_development_dependency(%q<kramdown>.freeze, ["~> 2.0".freeze])
@@ -36,6 +36,31 @@ describe Ollama::Commands::Embed do
36
36
  )
37
37
  end
38
38
 
39
+ it 'can be instantiated with dimensions' do
40
+ embed = described_class.new(
41
+ model: 'all-minilm',
42
+ input: 'Why is the sky blue?',
43
+ dimensions: 128
44
+ )
45
+ expect(embed).to be_a described_class
46
+ expect(embed.dimensions).to eq(128)
47
+ end
48
+
49
+ it 'can be converted to JSON with dimensions' do
50
+ embed = described_class.new(
51
+ model: 'all-minilm',
52
+ input: 'Why is the sky blue?',
53
+ dimensions: 128
54
+ )
55
+ expect(embed.as_json).to include(
56
+ model: 'all-minilm',
57
+ input: 'Why is the sky blue?',
58
+ dimensions: 128
59
+ )
60
+ expect(embed.to_json).to eq(
61
+ '{"model":"all-minilm","input":"Why is the sky blue?","dimensions":128,"stream":false}'
62
+ )
63
+ end
39
64
 
40
65
  it 'can perform' do
41
66
  embed = described_class.new(
@@ -1,6 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Ollama::Handlers::Say do
3
+ skip_reason = nil
4
+ unless File.executable?(`which say`.chomp)
5
+ skip_reason = 'Command say not in path'
6
+ end
7
+
8
+ describe Ollama::Handlers::Say, skip: skip_reason do
4
9
  let :say do
5
10
  described_class.new
6
11
  end
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.8.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '2.6'
18
+ version: '2.8'
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '2.6'
25
+ version: '2.8'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: all_images
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -383,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
383
383
  - !ruby/object:Gem::Version
384
384
  version: '0'
385
385
  requirements: []
386
- rubygems_version: 3.6.9
386
+ rubygems_version: 3.7.2
387
387
  specification_version: 4
388
388
  summary: Interacting with the Ollama API
389
389
  test_files: