ollama-ruby 1.19.2 → 1.20.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 +29 -0
- data/lib/ollama/commands/embeddings.rb +10 -3
- data/lib/ollama/message.rb +16 -3
- data/lib/ollama/version.rb +1 -1
- data/ollama-ruby.gemspec +4 -4
- 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 +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4aa3110a7c8d679883631b55cc3d134d9f94e706d58a0be729dc2c360aacaf1c
|
|
4
|
+
data.tar.gz: 0a05054f0afa81f26a66d382a3b589944d4cc171b9340913b79abba70ca6538e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca23af417cad95de0c50b0a7216894b4c1cb0324a1c571a16f774aac34229afca4f505f95317da42c81becdacb3316143376cc61d7b0ecca35c6d51f0a8f68a3
|
|
7
|
+
data.tar.gz: cfc226bbf703772ce397f35726632869a5c1637278c7d46d4f5932af3f0e0794f4d179af76dafbcd40f3fe33272f765c8306c087d482f8e2708351266e2b026f
|
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,34 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-03-20 v1.20.0
|
|
4
|
+
|
|
5
|
+
- Created `.rspec` file with `--force-color` and `-r spec_helper` options.
|
|
6
|
+
- Removed `require 'spec_helper'` from all spec files.
|
|
7
|
+
- Added `dimensions` keyword argument to `initialize` in
|
|
8
|
+
`lib/ollama/commands/embeddings.rb`.
|
|
9
|
+
- Added `@dimensions` instance variable and `attr_reader :dimensions` to
|
|
10
|
+
`Ollama::Commands::Embeddings`.
|
|
11
|
+
- Reordered instance variables in the constructor of
|
|
12
|
+
`Ollama::Commands::Embeddings`.
|
|
13
|
+
- Added `.envrc` setting `OLLAMA_CHAT_TOOLS_TEST_RUNNER`.
|
|
14
|
+
- Added `tool_calls` and `tool_name` reader attributes to `Ollama::Message` in
|
|
15
|
+
`lib/ollama/message.rb`.
|
|
16
|
+
- Extended `initialize` signature of `Ollama::Message` to accept `tool_calls`
|
|
17
|
+
and `tool_name` and store them.
|
|
18
|
+
- Updated `message_spec.rb` to include `tool_calls` and `tool_name` in
|
|
19
|
+
expectations for JSON serialization and round‑trip.
|
|
20
|
+
- Normalized `tool_calls` to an array when provided.
|
|
21
|
+
- Added `.utilsrc` file with configuration blocks for `search`, `discover`,
|
|
22
|
+
`strip_spaces`, `probe`, `ssh_tunnel`, `classify`, and `code_indexer`.
|
|
23
|
+
- Configured pruning of directories such as `.svn`, `.git`, `CVS`, `tmp`,
|
|
24
|
+
`coverage`, etc., and skipped files matching patterns like `\.sw[pon]`,
|
|
25
|
+
`\.(log|fnm|jpg|jpeg|png|pdf|svg)`.
|
|
26
|
+
- Set RSpec (`:rspec`) as the test framework in `probe`.
|
|
27
|
+
- Enabled tmux terminal multiplexer for SSH tunnels with login session to
|
|
28
|
+
`/home/${ENV['USER']}` via `ssh_tunnel`.
|
|
29
|
+
- Defined a comprehensive gem list (e.g., `all_images`, `amatch`, `base64`, …,
|
|
30
|
+
`yard`) and included their paths using `bundle show`.
|
|
31
|
+
|
|
3
32
|
## 2026-03-08 v1.19.2
|
|
4
33
|
|
|
5
34
|
- Improve polling loop safety in `ollama_ps`.
|
|
@@ -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/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.20.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.20.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 = "
|
|
21
|
+
s.rubygems_version = "3.6.9".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
|
|
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.20.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -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:
|
|
418
|
+
rubygems_version: 3.6.9
|
|
417
419
|
specification_version: 4
|
|
418
420
|
summary: Interacting with the Ollama API
|
|
419
421
|
test_files:
|