ollama-ruby 0.14.1 → 0.16.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: ca130b81b4baf0c93d2b727beef4f87a13fe7a1b97006963e780620372091d7f
4
- data.tar.gz: 95dcad426a570bd1b78abf24bc868be1b1ce3836fd52c7a02ae4d9b857371500
3
+ metadata.gz: 96d3c8afe0962abc4938b2e2d6cea5dd773e224ac05e87f819b371429083d79d
4
+ data.tar.gz: 6e293ec73919c33eede640b9043b9adfff00f5d9761c1d2759f022016a2b6daa
5
5
  SHA512:
6
- metadata.gz: 208bbe4f45666e567e4f1ddb34c642490efd62ba2945386f83b4fdfeedbcfc9bda30780ded742be631d371c26b6e69c2b7fa487470f70a19491017f44eab9773
7
- data.tar.gz: 6f272e0d919b65a567c67f509e2e5571d1358f3357087578e6931b1a0dc6db0ede94f181d012268dea0c303016206e349634496bc02f790b04789b5e790e7709
6
+ metadata.gz: c11223503b8ff33ed77c0629f52ea5eb703ac8fc838b6a258e27e07eda297c66ad40ec672fccf1e5dd9e00f432754b219196114dd1bed93bacdd7760451d88db
7
+ data.tar.gz: 2d089cfaaeccced65a17dbe622ec9f621238241c25c24b6504815310e3bc157f3a7baba95747275d4300292722dc5df2a74fa6cef581a7997af65e9bd86613cb
data/CHANGES.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-02-17 v0.16.0
4
+
5
+ * Updated Ollama CLI with new handler that allows saving of chat and
6
+ continuation with `ollama_chat`:
7
+ * Added `require 'tins/xt/secure_write'` and `require 'tmpdir'`.
8
+ * Created a new `ChatStart` class that handles chat responses.
9
+ * Updated options parsing to use `ChatStart` as the default handler.
10
+ * Changed code to handle `ChatStart` instances.
11
+ * Added secure write functionality for chat conversation in tmpdir.
12
+ * Added `yaml-dev` to `apk add` command in `.all_images.yml`
13
+
14
+ ## 2025-02-12 v0.15.0
15
+
16
+ * Added "version" command to display version of the ollama server:
17
+ + Updated `Commands` list in README.md to include new `version` command
18
+ + Added new section for `Version` information in README.md
19
+ + Added example usage of `jj version` command
20
+ * Added basic spec for Ollama::Commands::Version class:
21
+ + Defined a describe block for Ollama::Commands::Version with one let and three it blocks:
22
+ - It can be instantiated
23
+ - It cannot be converted to JSON
24
+ - It can perform, including setting the client and expecting a request to be made
25
+ * Added version command for API endpoint:
26
+ + Added `ollama/commands/version` class
27
+ + Updated `ollama/client.rb` to include `version` command
28
+ + Updated doc links in `ollama/client/doc.rb`
29
+ + Added support for `/api/version` API endpoint
30
+
3
31
  ## 2025-01-29 v0.14.1
4
32
 
5
33
  * Removed dependency on `Documentrix`:
data/README.md CHANGED
@@ -50,7 +50,7 @@ response and displays it on the screen using the Markdown handler:
50
50
 
51
51
  ```bash
52
52
  ollama_console
53
- Commands: chat,copy,create,delete,embeddings,generate,help,ps,pull,push,show,tags
53
+ Commands: chat,copy,create,delete,embeddings,generate,help,ps,pull,push,show,tags,version
54
54
  >> generate(model: 'llama3.1', stream: true, prompt: 'tell story w/ emoji and markdown', &Markdown)
55
55
  ```
56
56
 
@@ -219,6 +219,14 @@ embeddings(model: 'llama3.1', prompt: 'The sky is blue because of rayleigh scatt
219
219
  jj ps
220
220
  ```
221
221
 
222
+ ### Version
223
+
224
+ `default_handler` is **Single**, streaming is not possible.
225
+
226
+ ```ruby
227
+ jj version
228
+ ```
229
+
222
230
  ## Auxiliary objects
223
231
 
224
232
  The following objects are provided to interact with the ollama server. You can
@@ -392,6 +400,9 @@ gem install ollama-chat
392
400
  Once installed, you can run `ollama_chat` from your terminal or command prompt.
393
401
  This will launch a chat interface where you can interact with an LLM.
394
402
 
403
+ See its [github repository](https://github.com/flori/ollama_chat) for more
404
+ information.
405
+
395
406
  ## Download
396
407
 
397
408
  The homepage of this library is located at
data/bin/ollama_cli CHANGED
@@ -4,7 +4,30 @@ require 'ollama'
4
4
  include Ollama
5
5
  require 'tins'
6
6
  include Tins::GO
7
+ require 'tins/xt/secure_write'
7
8
  require 'json'
9
+ require 'tmpdir'
10
+
11
+ class ChatStart
12
+ include Ollama::Handlers::Concern
13
+
14
+ def initialize(output: $stdout)
15
+ super
16
+ @output.sync = true
17
+ @content = ''
18
+ end
19
+
20
+ attr_reader :content
21
+
22
+ def call(response)
23
+ if content = response.response
24
+ @content << content
25
+ @output << content
26
+ end
27
+ response.done and @output.puts
28
+ self
29
+ end
30
+ end
8
31
 
9
32
  # Returns the contents of a file or string, or a default value if neither is provided.
10
33
  #
@@ -49,7 +72,7 @@ def usage
49
72
  -p PROMPT the user prompt to use as a file, $OLLAMA_PROMPT
50
73
  if it contains %{stdin} it is substituted by stdin input
51
74
  -P VARIABLE sets prompt var %{foo} to "bar" if VARIABLE is foo=bar
52
- -H HANDLER the handler to use for the response, defaults to Print
75
+ -H HANDLER the handler to use for the response, defaults to ChatStart
53
76
  -S use streaming for generation
54
77
  -h this help
55
78
 
@@ -57,7 +80,7 @@ def usage
57
80
  exit 0
58
81
  end
59
82
 
60
- opts = go 'u:m:M:s:p:P:H:Sh', defaults: { ?H => 'Print', ?M => '{}' }
83
+ opts = go 'u:m:M:s:p:P:H:Sh', defaults: { ?H => 'ChatStart', ?M => '{}' }
61
84
 
62
85
  opts[?h] and usage
63
86
 
@@ -91,11 +114,30 @@ if ENV['DEBUG'].to_i == 1
91
114
  EOT
92
115
  end
93
116
 
117
+ handler = Object.const_get(opts[?H])
118
+ handler == ChatStart and handler = handler.new
119
+
94
120
  Client.new(base_url:, read_timeout: 120).generate(
95
121
  model:,
96
122
  system:,
97
123
  prompt:,
98
124
  options:,
99
125
  stream: !!opts[?S],
100
- &Object.const_get(opts[?H])
126
+ &handler
101
127
  )
128
+
129
+ if handler.is_a?(ChatStart)
130
+ filename = File.join(Dir.tmpdir, 'chat_start_%u.json' % $$)
131
+ File.secure_write(filename) do |out|
132
+ JSON.dump(
133
+ [
134
+ Message.new(role: 'user', content: prompt),
135
+ Message.new(role: 'assistant', content: handler.content),
136
+ ],
137
+ out
138
+ )
139
+ end
140
+ if STDERR.tty?
141
+ STDERR.puts "\nContinue the chat with: ollama_chat -c '%s'" % filename
142
+ end
143
+ end
@@ -18,6 +18,7 @@ class Ollama::Client::Doc
18
18
  embeddings: 'https://github.com/ollama/ollama/blob/main/docs/api.md#generate-embeddings', # superseded by /api/embed
19
19
  embed: 'https://github.com/ollama/ollama/blob/main/docs/api.md#generate-embeddings',
20
20
  ps: 'https://github.com/ollama/ollama/blob/main/docs/api.md#list-running-models',
21
+ version: 'https://github.com/ollama/ollama/blob/main/docs/api.md#version',
21
22
  )[name]
22
23
  end
23
24
 
data/lib/ollama/client.rb CHANGED
@@ -57,6 +57,8 @@ class Ollama::Client
57
57
 
58
58
  command(:ps, default_handler: Single)
59
59
 
60
+ command(:version, default_handler: Single)
61
+
60
62
  def commands
61
63
  doc_annotations.sort_by(&:first).transpose.last
62
64
  end
@@ -0,0 +1,17 @@
1
+ class Ollama::Commands::Version
2
+ def self.path
3
+ '/api/version'
4
+ end
5
+
6
+ def initialize()
7
+ @stream = false
8
+ end
9
+
10
+ attr_reader :stream
11
+
12
+ attr_writer :client
13
+
14
+ def perform(handler)
15
+ @client.request(method: :get, path: self.class.path, stream:, handler:)
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  module Ollama
2
2
  # Ollama version
3
- VERSION = '0.14.1'
3
+ VERSION = '0.16.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/lib/ollama.rb CHANGED
@@ -39,5 +39,6 @@ require 'ollama/commands/push'
39
39
  require 'ollama/commands/embed'
40
40
  require 'ollama/commands/embeddings'
41
41
  require 'ollama/commands/ps'
42
+ require 'ollama/commands/version'
42
43
 
43
44
  require 'ollama/client'
data/ollama-ruby.gemspec CHANGED
@@ -1,26 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama-ruby 0.14.1 ruby lib
2
+ # stub: ollama-ruby 0.16.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama-ruby".freeze
6
- s.version = "0.14.1".freeze
6
+ s.version = "0.16.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]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2025-01-29"
11
+ s.date = "2025-02-17"
12
12
  s.description = "Library that allows interacting with the Ollama API".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ollama_console".freeze, "ollama_update".freeze, "ollama_cli".freeze]
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/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/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/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 = [".envrc".freeze, ".yardopts".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_cli".freeze, "bin/ollama_console".freeze, "bin/ollama_update".freeze, "lib/ollama.rb".freeze, "lib/ollama/client.rb".freeze, "lib/ollama/client/command.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/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/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/kitten.jpg".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/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]
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/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/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 = [".yardopts".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_cli".freeze, "bin/ollama_console".freeze, "bin/ollama_update".freeze, "lib/ollama.rb".freeze, "lib/ollama/client.rb".freeze, "lib/ollama/client/command.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/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/kitten.jpg".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
21
  s.rubygems_version = "3.6.2".freeze
22
22
  s.summary = "Interacting with the Ollama API".freeze
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/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]
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
 
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Ollama::Commands::Version do
4
+ let :version do
5
+ described_class.new
6
+ end
7
+
8
+ it 'can be instantiated' do
9
+ expect(version).to be_a described_class
10
+ end
11
+
12
+ it 'cannot be converted to JSON' do
13
+ expect(version).not_to respond_to(:as_json)
14
+ end
15
+
16
+ it 'can perform' do
17
+ version.client = ollama = double('Ollama::Client')
18
+ expect(ollama).to receive(:request).
19
+ with(
20
+ method: :get, path: '/api/version', handler: Ollama::Handlers::NOP,
21
+ stream: false
22
+ )
23
+ version.perform(Ollama::Handlers::NOP)
24
+ end
25
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-29 00:00:00.000000000 Z
10
+ date: 2025-02-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: gem_hadar
@@ -236,6 +236,7 @@ extra_rdoc_files:
236
236
  - lib/ollama/commands/push.rb
237
237
  - lib/ollama/commands/show.rb
238
238
  - lib/ollama/commands/tags.rb
239
+ - lib/ollama/commands/version.rb
239
240
  - lib/ollama/dto.rb
240
241
  - lib/ollama/errors.rb
241
242
  - lib/ollama/handlers.rb
@@ -259,7 +260,6 @@ extra_rdoc_files:
259
260
  - lib/ollama/tool/function/parameters/property.rb
260
261
  - lib/ollama/version.rb
261
262
  files:
262
- - ".envrc"
263
263
  - ".yardopts"
264
264
  - CHANGES.md
265
265
  - Gemfile
@@ -285,6 +285,7 @@ files:
285
285
  - lib/ollama/commands/push.rb
286
286
  - lib/ollama/commands/show.rb
287
287
  - lib/ollama/commands/tags.rb
288
+ - lib/ollama/commands/version.rb
288
289
  - lib/ollama/dto.rb
289
290
  - lib/ollama/errors.rb
290
291
  - lib/ollama/handlers.rb
@@ -323,6 +324,7 @@ files:
323
324
  - spec/ollama/commands/push_spec.rb
324
325
  - spec/ollama/commands/show_spec.rb
325
326
  - spec/ollama/commands/tags_spec.rb
327
+ - spec/ollama/commands/version_spec.rb
326
328
  - spec/ollama/handlers/collector_spec.rb
327
329
  - spec/ollama/handlers/dump_json_spec.rb
328
330
  - spec/ollama/handlers/dump_yaml_spec.rb
@@ -378,6 +380,7 @@ test_files:
378
380
  - spec/ollama/commands/push_spec.rb
379
381
  - spec/ollama/commands/show_spec.rb
380
382
  - spec/ollama/commands/tags_spec.rb
383
+ - spec/ollama/commands/version_spec.rb
381
384
  - spec/ollama/handlers/collector_spec.rb
382
385
  - spec/ollama/handlers/dump_json_spec.rb
383
386
  - spec/ollama/handlers/dump_yaml_spec.rb
data/.envrc DELETED
@@ -1,2 +0,0 @@
1
- export REDIS_URL=redis://localhost:9736
2
- export REDIS_EXPRING_URL=redis://localhost:9736