ollama-ruby 1.19.2 → 1.21.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/.envrc +1 -0
- data/.utilsrc +78 -0
- data/CHANGES.md +40 -0
- data/Rakefile +1 -1
- data/lib/ollama/commands/create.rb +7 -2
- data/lib/ollama/commands/embeddings.rb +10 -3
- data/lib/ollama/image.rb +9 -0
- data/lib/ollama/message.rb +16 -3
- data/lib/ollama/version.rb +1 -1
- data/ollama-ruby.gemspec +5 -5
- data/spec/ollama/client/doc_spec.rb +0 -2
- data/spec/ollama/client_spec.rb +0 -2
- data/spec/ollama/commands/chat_spec.rb +0 -2
- data/spec/ollama/commands/copy_spec.rb +0 -2
- data/spec/ollama/commands/create_spec.rb +0 -2
- data/spec/ollama/commands/delete_spec.rb +0 -2
- data/spec/ollama/commands/embed_spec.rb +0 -2
- data/spec/ollama/commands/embeddings_spec.rb +0 -2
- data/spec/ollama/commands/generate_spec.rb +0 -2
- data/spec/ollama/commands/ps_spec.rb +0 -2
- data/spec/ollama/commands/pull_spec.rb +0 -2
- data/spec/ollama/commands/push_spec.rb +0 -2
- data/spec/ollama/commands/show_spec.rb +0 -2
- data/spec/ollama/commands/tags_spec.rb +0 -2
- data/spec/ollama/commands/version_spec.rb +0 -2
- data/spec/ollama/handlers/collector_spec.rb +0 -2
- data/spec/ollama/handlers/dump_json_spec.rb +0 -2
- data/spec/ollama/handlers/dump_yaml_spec.rb +0 -2
- data/spec/ollama/handlers/markdown_spec.rb +0 -2
- data/spec/ollama/handlers/nop_spec.rb +0 -2
- data/spec/ollama/handlers/print_spec.rb +0 -2
- data/spec/ollama/handlers/progress_spec.rb +0 -2
- data/spec/ollama/handlers/say_spec.rb +0 -2
- data/spec/ollama/handlers/single_spec.rb +0 -2
- data/spec/ollama/image_spec.rb +0 -2
- data/spec/ollama/message_spec.rb +11 -5
- data/spec/ollama/options_spec.rb +0 -2
- data/spec/ollama/tool_spec.rb +0 -2
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ba6bf03f34b785b65a26f7bcdeb2d77d00c8f4d2403987d31258b1f78d27680
|
|
4
|
+
data.tar.gz: ee8337571ff29a5fb2db7f514ec4037ce4dca00da9193d18f80cff671dde06a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0f70a40fe9cc263e073df7f30e358d3ed9ff416b74ebf281cd9324ae73bcf2c27d23c3e41e92a5d1524b013a39706f243322b9344a9ee68759ea5ea214286dce
|
|
7
|
+
data.tar.gz: a6091750f7b86920191ff2dca0efde302ecfbd2f2af11a43bb41b8b01ac44016b9b273a15461b6d2f582dbff05be9162139cf9305d4fa85ce67e4010344f2637
|
data/.envrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export OLLAMA_CHAT_TOOLS_TEST_RUNNER="bundle exec rspec"
|
data/.utilsrc
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# vim: set ft=ruby:
|
|
2
|
+
|
|
3
|
+
search do
|
|
4
|
+
prune_dirs /\A(\.svn|\.git|CVS|tmp|coverage|pkg|\.yardoc|doc)\z/
|
|
5
|
+
skip_files /(\A\.|\.sw[pon]\z|\.(log|fnm|jpg|jpeg|png|pdf|svg)\z|\A(tags|cscope\.out)\z|~\z)/i
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
discover do
|
|
9
|
+
prune_dirs /\A(\.svn|\.git|\.yardoc|CVS|tmp|coverage|corpus|pkg|\.yardoc|doc)\z/
|
|
10
|
+
skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
|
|
11
|
+
index_expire_after 3_600
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
strip_spaces do
|
|
15
|
+
prune_dirs /\A(\..*|CVS|pkg|\.yardoc)\z/
|
|
16
|
+
skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
probe do
|
|
20
|
+
test_framework :rspec
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
ssh_tunnel do
|
|
24
|
+
terminal_multiplexer :tmux
|
|
25
|
+
login_session "/home/#{ENV['USER']}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
classify do
|
|
29
|
+
shift_path_by_default 1
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
code_indexer do
|
|
33
|
+
verbose false
|
|
34
|
+
|
|
35
|
+
gems = %w[
|
|
36
|
+
all_images
|
|
37
|
+
amatch
|
|
38
|
+
base64
|
|
39
|
+
bigdecimal
|
|
40
|
+
complex_config
|
|
41
|
+
context_spook
|
|
42
|
+
date
|
|
43
|
+
excon
|
|
44
|
+
fileutils
|
|
45
|
+
gem_hadar
|
|
46
|
+
infobar
|
|
47
|
+
irb
|
|
48
|
+
json
|
|
49
|
+
kramdown
|
|
50
|
+
kramdown-ansi
|
|
51
|
+
kramdown-parser-gfm
|
|
52
|
+
mize
|
|
53
|
+
more_math
|
|
54
|
+
ollama-ruby
|
|
55
|
+
ostruct
|
|
56
|
+
pathname
|
|
57
|
+
readline
|
|
58
|
+
reline
|
|
59
|
+
rspec
|
|
60
|
+
rspec-core
|
|
61
|
+
rspec-expectations
|
|
62
|
+
rspec-mocks
|
|
63
|
+
rspec-support
|
|
64
|
+
search_ui
|
|
65
|
+
shellwords
|
|
66
|
+
stringio
|
|
67
|
+
term-ansicolor
|
|
68
|
+
terminal-table
|
|
69
|
+
tins
|
|
70
|
+
uri
|
|
71
|
+
webmock
|
|
72
|
+
yard
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
paths {
|
|
76
|
+
%w[ lib ] + gems.map { `bundle show #{it}` }.map(&:chomp)
|
|
77
|
+
}
|
|
78
|
+
end
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-03-20 v1.21.0
|
|
4
|
+
|
|
5
|
+
- Added a template accessor to Ollama::Commands::Create, exposing a new
|
|
6
|
+
`attr_reader` :template with a descriptive comment block.
|
|
7
|
+
- Added `to_json` method to `Ollama::Image` class that delegates to `as_json`
|
|
8
|
+
- Included documentation comments for the new `to_json` method
|
|
9
|
+
- Ensures `as_json` is properly invoked when serializing `Ollama::Image`
|
|
10
|
+
objects with Ruby's JSON gems
|
|
11
|
+
- Updated `terminal-table` dependency from `~> 3.0` to `>= 3.0` in Rakefile
|
|
12
|
+
- Updated gemspec dependency for `terminal-table` to `>= 3.0`
|
|
13
|
+
|
|
14
|
+
## 2026-03-20 v1.20.0
|
|
15
|
+
|
|
16
|
+
- Created `.rspec` file with `--force-color` and `-r spec_helper` options.
|
|
17
|
+
- Removed `require 'spec_helper'` from all spec files.
|
|
18
|
+
- Added `dimensions` keyword argument to `initialize` in
|
|
19
|
+
`lib/ollama/commands/embeddings.rb`.
|
|
20
|
+
- Added `@dimensions` instance variable and `attr_reader :dimensions` to
|
|
21
|
+
`Ollama::Commands::Embeddings`.
|
|
22
|
+
- Reordered instance variables in the constructor of
|
|
23
|
+
`Ollama::Commands::Embeddings`.
|
|
24
|
+
- Added `.envrc` setting `OLLAMA_CHAT_TOOLS_TEST_RUNNER`.
|
|
25
|
+
- Added `tool_calls` and `tool_name` reader attributes to `Ollama::Message` in
|
|
26
|
+
`lib/ollama/message.rb`.
|
|
27
|
+
- Extended `initialize` signature of `Ollama::Message` to accept `tool_calls`
|
|
28
|
+
and `tool_name` and store them.
|
|
29
|
+
- Updated `message_spec.rb` to include `tool_calls` and `tool_name` in
|
|
30
|
+
expectations for JSON serialization and round‑trip.
|
|
31
|
+
- Normalized `tool_calls` to an array when provided.
|
|
32
|
+
- Added `.utilsrc` file with configuration blocks for `search`, `discover`,
|
|
33
|
+
`strip_spaces`, `probe`, `ssh_tunnel`, `classify`, and `code_indexer`.
|
|
34
|
+
- Configured pruning of directories such as `.svn`, `.git`, `CVS`, `tmp`,
|
|
35
|
+
`coverage`, etc., and skipped files matching patterns like `\.sw[pon]`,
|
|
36
|
+
`\.(log|fnm|jpg|jpeg|png|pdf|svg)`.
|
|
37
|
+
- Set RSpec (`:rspec`) as the test framework in `probe`.
|
|
38
|
+
- Enabled tmux terminal multiplexer for SSH tunnels with login session to
|
|
39
|
+
`/home/${ENV['USER']}` via `ssh_tunnel`.
|
|
40
|
+
- Defined a comprehensive gem list (e.g., `all_images`, `amatch`, `base64`, …,
|
|
41
|
+
`yard`) and included their paths using `bundle show`.
|
|
42
|
+
|
|
3
43
|
## 2026-03-08 v1.19.2
|
|
4
44
|
|
|
5
45
|
- Improve polling loop safety in `ollama_ps`.
|
data/Rakefile
CHANGED
|
@@ -38,7 +38,7 @@ GemHadar do
|
|
|
38
38
|
dependency 'term-ansicolor', '~> 1.11'
|
|
39
39
|
dependency 'kramdown-ansi', '~> 0.0', '>= 0.0.1'
|
|
40
40
|
dependency 'ostruct', '~> 0.0'
|
|
41
|
-
dependency 'terminal-table', '
|
|
41
|
+
dependency 'terminal-table', '>= 3.0'
|
|
42
42
|
dependency 'nokogiri', '~> 1.0'
|
|
43
43
|
development_dependency 'all_images', '~> 0.12'
|
|
44
44
|
development_dependency 'rspec', '~> 3.2'
|
|
@@ -48,8 +48,8 @@ class Ollama::Commands::Create
|
|
|
48
48
|
# @param stream [ TrueClass, FalseClass ] whether to enable streaming for the operation, defaults to true
|
|
49
49
|
# @param quantize [ String, nil ] quantization method to use (e.g., 'Q4_0')
|
|
50
50
|
def initialize(model:, from: nil, files: nil, adapters: nil, template: nil, license: nil, system: nil, parameters: nil, messages: nil, stream: true, quantize: nil)
|
|
51
|
-
@model, @from, @files, @adapters, @license, @system, @parameters, @messages, @stream, @quantize =
|
|
52
|
-
model, from, as_hash(files), as_hash(adapters), as_array(license), system,
|
|
51
|
+
@model, @from, @files, @adapters, @template, @license, @system, @parameters, @messages, @stream, @quantize =
|
|
52
|
+
model, from, as_hash(files), as_hash(adapters), template, as_array(license), system,
|
|
53
53
|
as_hash(parameters), as_array_of_hashes(messages), stream, quantize
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -73,6 +73,11 @@ class Ollama::Commands::Create
|
|
|
73
73
|
# @return [ Hash, nil ] adapter files to use for quantization
|
|
74
74
|
attr_reader :adapters
|
|
75
75
|
|
|
76
|
+
# The template attribute reader returns the template associated with the object.
|
|
77
|
+
#
|
|
78
|
+
# @return [ String, nil ] the template string or nil if not defined
|
|
79
|
+
attr_reader :template
|
|
80
|
+
|
|
76
81
|
# The license attribute reader returns the license(s) associated with the object.
|
|
77
82
|
#
|
|
78
83
|
# @return [ String, Array<String>, nil ] the license(s) for the model
|
|
@@ -32,9 +32,10 @@ class Ollama::Commands::Embeddings
|
|
|
32
32
|
# @param prompt [ String ] the text prompt to generate embeddings for
|
|
33
33
|
# @param options [ Ollama::Options, nil ] optional configuration parameters for the model
|
|
34
34
|
# @param keep_alive [ String, nil ] duration to keep the model loaded in memory
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
# @param dimensions [ Integer, nil ] number of dimensions for the embedding
|
|
36
|
+
def initialize(model:, prompt:, options: nil, keep_alive: nil, dimensions: nil)
|
|
37
|
+
@model, @prompt, @options, @keep_alive, @dimensions, @stream =
|
|
38
|
+
model, prompt, options, dimensions, keep_alive, false
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
# The model attribute reader returns the model name associated with the object.
|
|
@@ -57,6 +58,12 @@ class Ollama::Commands::Embeddings
|
|
|
57
58
|
# @return [ String, nil ] duration to keep the model loaded in memory
|
|
58
59
|
attr_reader :keep_alive
|
|
59
60
|
|
|
61
|
+
# The dimensions attribute reader returns the dimensions associated with the
|
|
62
|
+
# object.
|
|
63
|
+
#
|
|
64
|
+
# @return [ Integer, nil ]
|
|
65
|
+
attr_reader :dimensions
|
|
66
|
+
|
|
60
67
|
# The stream attribute reader returns the streaming behavior setting
|
|
61
68
|
# associated with the object.
|
|
62
69
|
#
|
data/lib/ollama/image.rb
CHANGED
|
@@ -116,4 +116,13 @@ class Ollama::Image
|
|
|
116
116
|
def as_json(*_args)
|
|
117
117
|
to_s
|
|
118
118
|
end
|
|
119
|
+
|
|
120
|
+
# The to_json method converts the object's JSON representation into a JSON
|
|
121
|
+
# string format.
|
|
122
|
+
#
|
|
123
|
+
# @param args [Array] optional arguments passed to JSON serialization
|
|
124
|
+
# @return [String] a JSON string representation of the object
|
|
125
|
+
def to_json(*args)
|
|
126
|
+
as_json.to_json(*args)
|
|
127
|
+
end
|
|
119
128
|
end
|
data/lib/ollama/message.rb
CHANGED
|
@@ -41,6 +41,18 @@ class Ollama::Message
|
|
|
41
41
|
# @return [ Array<Ollama::Image>, nil ] an array of image objects, or nil if no images are associated with the message
|
|
42
42
|
attr_reader :images
|
|
43
43
|
|
|
44
|
+
# The tool_calls attribute reader returns the tool call hashes or objects
|
|
45
|
+
# associated with the message.
|
|
46
|
+
#
|
|
47
|
+
# @return [ Array<Hash>, nil ] an array of tool call definitions, or nil if none
|
|
48
|
+
attr_reader :tool_calls
|
|
49
|
+
|
|
50
|
+
# The tool_name attribute reader returns the name of the tool used in the
|
|
51
|
+
# message, if any.
|
|
52
|
+
#
|
|
53
|
+
# @return [ String, nil ] the name of the tool, or nil if not set
|
|
54
|
+
attr_reader :tool_name
|
|
55
|
+
|
|
44
56
|
# The initialize method sets up a new Message instance with the specified attributes.
|
|
45
57
|
#
|
|
46
58
|
# @param role [ String ] the role of the message sender, such as 'user' or 'assistant'
|
|
@@ -48,9 +60,10 @@ class Ollama::Message
|
|
|
48
60
|
# @param thinking [ String, nil ] optional thinking content for the message
|
|
49
61
|
# @param images [ Ollama::Image, Array<Ollama::Image>, nil ] optional image objects associated with the message
|
|
50
62
|
# @param tool_calls [ Hash, Array<Hash>, nil ] optional tool calls made in the message
|
|
51
|
-
def initialize(role:, content:, thinking: nil, images: nil, tool_calls: nil, **)
|
|
52
|
-
@role, @content, @thinking, @images, @tool_calls =
|
|
63
|
+
def initialize(role:, content:, thinking: nil, images: nil, tool_calls: nil, tool_name: nil, **)
|
|
64
|
+
@role, @content, @thinking, @images, @tool_calls, @tool_name =
|
|
53
65
|
role, content, thinking, (Array(images) if images),
|
|
54
|
-
(Array(tool_calls) if tool_calls)
|
|
66
|
+
(Array(tool_calls) if tool_calls),
|
|
67
|
+
tool_name
|
|
55
68
|
end
|
|
56
69
|
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.21.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.21.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]
|
|
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.email = "flori@ping.de".freeze
|
|
14
14
|
s.executables = ["ollama_console".freeze, "ollama_update".freeze, "ollama_cli".freeze, "ollama_browse".freeze, "ollama_ps".freeze]
|
|
15
15
|
s.extra_rdoc_files = ["README.md".freeze, "lib/ollama.rb".freeze, "lib/ollama/client.rb".freeze, "lib/ollama/client/command.rb".freeze, "lib/ollama/client/configuration/config.rb".freeze, "lib/ollama/client/doc.rb".freeze, "lib/ollama/commands/chat.rb".freeze, "lib/ollama/commands/copy.rb".freeze, "lib/ollama/commands/create.rb".freeze, "lib/ollama/commands/delete.rb".freeze, "lib/ollama/commands/embed.rb".freeze, "lib/ollama/commands/embeddings.rb".freeze, "lib/ollama/commands/generate.rb".freeze, "lib/ollama/commands/ps.rb".freeze, "lib/ollama/commands/pull.rb".freeze, "lib/ollama/commands/push.rb".freeze, "lib/ollama/commands/show.rb".freeze, "lib/ollama/commands/tags.rb".freeze, "lib/ollama/commands/version.rb".freeze, "lib/ollama/dto.rb".freeze, "lib/ollama/errors.rb".freeze, "lib/ollama/handlers.rb".freeze, "lib/ollama/handlers/collector.rb".freeze, "lib/ollama/handlers/concern.rb".freeze, "lib/ollama/handlers/dump_json.rb".freeze, "lib/ollama/handlers/dump_yaml.rb".freeze, "lib/ollama/handlers/markdown.rb".freeze, "lib/ollama/handlers/nop.rb".freeze, "lib/ollama/handlers/print.rb".freeze, "lib/ollama/handlers/progress.rb".freeze, "lib/ollama/handlers/say.rb".freeze, "lib/ollama/handlers/single.rb".freeze, "lib/ollama/image.rb".freeze, "lib/ollama/json_loader.rb".freeze, "lib/ollama/message.rb".freeze, "lib/ollama/options.rb".freeze, "lib/ollama/response.rb".freeze, "lib/ollama/tool.rb".freeze, "lib/ollama/tool/function.rb".freeze, "lib/ollama/tool/function/parameters.rb".freeze, "lib/ollama/tool/function/parameters/property.rb".freeze, "lib/ollama/version.rb".freeze]
|
|
16
|
-
s.files = ["CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_browse".freeze, "bin/ollama_cli".freeze, "bin/ollama_console".freeze, "bin/ollama_ps".freeze, "bin/ollama_update".freeze, "lib/ollama.rb".freeze, "lib/ollama/client.rb".freeze, "lib/ollama/client/command.rb".freeze, "lib/ollama/client/configuration/config.rb".freeze, "lib/ollama/client/doc.rb".freeze, "lib/ollama/commands/chat.rb".freeze, "lib/ollama/commands/copy.rb".freeze, "lib/ollama/commands/create.rb".freeze, "lib/ollama/commands/delete.rb".freeze, "lib/ollama/commands/embed.rb".freeze, "lib/ollama/commands/embeddings.rb".freeze, "lib/ollama/commands/generate.rb".freeze, "lib/ollama/commands/ps.rb".freeze, "lib/ollama/commands/pull.rb".freeze, "lib/ollama/commands/push.rb".freeze, "lib/ollama/commands/show.rb".freeze, "lib/ollama/commands/tags.rb".freeze, "lib/ollama/commands/version.rb".freeze, "lib/ollama/dto.rb".freeze, "lib/ollama/errors.rb".freeze, "lib/ollama/handlers.rb".freeze, "lib/ollama/handlers/collector.rb".freeze, "lib/ollama/handlers/concern.rb".freeze, "lib/ollama/handlers/dump_json.rb".freeze, "lib/ollama/handlers/dump_yaml.rb".freeze, "lib/ollama/handlers/markdown.rb".freeze, "lib/ollama/handlers/nop.rb".freeze, "lib/ollama/handlers/print.rb".freeze, "lib/ollama/handlers/progress.rb".freeze, "lib/ollama/handlers/say.rb".freeze, "lib/ollama/handlers/single.rb".freeze, "lib/ollama/image.rb".freeze, "lib/ollama/json_loader.rb".freeze, "lib/ollama/message.rb".freeze, "lib/ollama/options.rb".freeze, "lib/ollama/response.rb".freeze, "lib/ollama/tool.rb".freeze, "lib/ollama/tool/function.rb".freeze, "lib/ollama/tool/function/parameters.rb".freeze, "lib/ollama/tool/function/parameters/property.rb".freeze, "lib/ollama/version.rb".freeze, "ollama-ruby.gemspec".freeze, "spec/assets/client.json".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/options.json".freeze, "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, "tmp/.keep".freeze]
|
|
16
|
+
s.files = [".envrc".freeze, ".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_browse".freeze, "bin/ollama_cli".freeze, "bin/ollama_console".freeze, "bin/ollama_ps".freeze, "bin/ollama_update".freeze, "lib/ollama.rb".freeze, "lib/ollama/client.rb".freeze, "lib/ollama/client/command.rb".freeze, "lib/ollama/client/configuration/config.rb".freeze, "lib/ollama/client/doc.rb".freeze, "lib/ollama/commands/chat.rb".freeze, "lib/ollama/commands/copy.rb".freeze, "lib/ollama/commands/create.rb".freeze, "lib/ollama/commands/delete.rb".freeze, "lib/ollama/commands/embed.rb".freeze, "lib/ollama/commands/embeddings.rb".freeze, "lib/ollama/commands/generate.rb".freeze, "lib/ollama/commands/ps.rb".freeze, "lib/ollama/commands/pull.rb".freeze, "lib/ollama/commands/push.rb".freeze, "lib/ollama/commands/show.rb".freeze, "lib/ollama/commands/tags.rb".freeze, "lib/ollama/commands/version.rb".freeze, "lib/ollama/dto.rb".freeze, "lib/ollama/errors.rb".freeze, "lib/ollama/handlers.rb".freeze, "lib/ollama/handlers/collector.rb".freeze, "lib/ollama/handlers/concern.rb".freeze, "lib/ollama/handlers/dump_json.rb".freeze, "lib/ollama/handlers/dump_yaml.rb".freeze, "lib/ollama/handlers/markdown.rb".freeze, "lib/ollama/handlers/nop.rb".freeze, "lib/ollama/handlers/print.rb".freeze, "lib/ollama/handlers/progress.rb".freeze, "lib/ollama/handlers/say.rb".freeze, "lib/ollama/handlers/single.rb".freeze, "lib/ollama/image.rb".freeze, "lib/ollama/json_loader.rb".freeze, "lib/ollama/message.rb".freeze, "lib/ollama/options.rb".freeze, "lib/ollama/response.rb".freeze, "lib/ollama/tool.rb".freeze, "lib/ollama/tool/function.rb".freeze, "lib/ollama/tool/function/parameters.rb".freeze, "lib/ollama/tool/function/parameters/property.rb".freeze, "lib/ollama/version.rb".freeze, "ollama-ruby.gemspec".freeze, "spec/assets/client.json".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/options.json".freeze, "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, "tmp/.keep".freeze]
|
|
17
17
|
s.homepage = "https://github.com/flori/ollama-ruby".freeze
|
|
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 = "4.0.
|
|
21
|
+
s.rubygems_version = "4.0.8".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
|
|
|
@@ -39,6 +39,6 @@ Gem::Specification.new do |s|
|
|
|
39
39
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.11".freeze])
|
|
40
40
|
s.add_runtime_dependency(%q<kramdown-ansi>.freeze, ["~> 0.0".freeze, ">= 0.0.1".freeze])
|
|
41
41
|
s.add_runtime_dependency(%q<ostruct>.freeze, ["~> 0.0".freeze])
|
|
42
|
-
s.add_runtime_dependency(%q<terminal-table>.freeze, ["
|
|
42
|
+
s.add_runtime_dependency(%q<terminal-table>.freeze, [">= 3.0".freeze])
|
|
43
43
|
s.add_runtime_dependency(%q<nokogiri>.freeze, ["~> 1.0".freeze])
|
|
44
44
|
end
|
data/spec/ollama/client_spec.rb
CHANGED
data/spec/ollama/image_spec.rb
CHANGED
data/spec/ollama/message_spec.rb
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
1
|
describe Ollama::Message do
|
|
4
2
|
let :image do
|
|
5
3
|
Ollama::Image.for_string("test")
|
|
6
4
|
end
|
|
7
5
|
|
|
6
|
+
let :tool_call do
|
|
7
|
+
{ name: "search", arguments: { query: "ruby" } }
|
|
8
|
+
end
|
|
9
|
+
|
|
8
10
|
let :message do
|
|
9
11
|
described_class.new(
|
|
10
12
|
role: 'user',
|
|
11
13
|
content: 'hello world',
|
|
12
14
|
thinking: 'which world?',
|
|
13
|
-
images: image
|
|
15
|
+
images: image,
|
|
16
|
+
tool_calls: [ tool_call ],
|
|
17
|
+
tool_name: 'search'
|
|
14
18
|
)
|
|
15
19
|
end
|
|
16
20
|
|
|
@@ -24,15 +28,17 @@ describe Ollama::Message do
|
|
|
24
28
|
content: 'hello world',
|
|
25
29
|
thinking: 'which world?',
|
|
26
30
|
images: [ image ],
|
|
31
|
+
tool_calls: [ tool_call ],
|
|
32
|
+
tool_name: 'search'
|
|
27
33
|
)
|
|
28
34
|
expect(message.to_json).to eq(
|
|
29
|
-
'{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA=="]}'
|
|
35
|
+
'{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA=="],"tool_calls":[{"name":"search","arguments":{"query":"ruby"}}],"tool_name":"search"}'
|
|
30
36
|
)
|
|
31
37
|
end
|
|
32
38
|
|
|
33
39
|
it 'can be restored from JSON' do
|
|
34
40
|
expect(described_class.from_hash(JSON(<<~'end'))).to be_a described_class
|
|
35
|
-
{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA==\n"]}
|
|
41
|
+
{"role":"user","content":"hello world","thinking":"which world?","images":["dGVzdA==\n"],"tool_calls":[{"name":"search","arguments":{"query":"ruby"}}],"tool_name":"search"}
|
|
36
42
|
end
|
|
37
43
|
end
|
|
38
44
|
|
data/spec/ollama/options_spec.rb
CHANGED
data/spec/ollama/tool_spec.rb
CHANGED
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.
|
|
4
|
+
version: 1.21.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -229,14 +229,14 @@ dependencies:
|
|
|
229
229
|
name: terminal-table
|
|
230
230
|
requirement: !ruby/object:Gem::Requirement
|
|
231
231
|
requirements:
|
|
232
|
-
- - "
|
|
232
|
+
- - ">="
|
|
233
233
|
- !ruby/object:Gem::Version
|
|
234
234
|
version: '3.0'
|
|
235
235
|
type: :runtime
|
|
236
236
|
prerelease: false
|
|
237
237
|
version_requirements: !ruby/object:Gem::Requirement
|
|
238
238
|
requirements:
|
|
239
|
-
- - "
|
|
239
|
+
- - ">="
|
|
240
240
|
- !ruby/object:Gem::Version
|
|
241
241
|
version: '3.0'
|
|
242
242
|
- !ruby/object:Gem::Dependency
|
|
@@ -306,6 +306,8 @@ extra_rdoc_files:
|
|
|
306
306
|
- lib/ollama/tool/function/parameters/property.rb
|
|
307
307
|
- lib/ollama/version.rb
|
|
308
308
|
files:
|
|
309
|
+
- ".envrc"
|
|
310
|
+
- ".utilsrc"
|
|
309
311
|
- CHANGES.md
|
|
310
312
|
- Gemfile
|
|
311
313
|
- LICENSE
|
|
@@ -413,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
413
415
|
- !ruby/object:Gem::Version
|
|
414
416
|
version: '0'
|
|
415
417
|
requirements: []
|
|
416
|
-
rubygems_version: 4.0.
|
|
418
|
+
rubygems_version: 4.0.8
|
|
417
419
|
specification_version: 4
|
|
418
420
|
summary: Interacting with the Ollama API
|
|
419
421
|
test_files:
|