ollama-ruby 1.4.0 → 1.5.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 +17 -0
- data/README.md +19 -22
- data/Rakefile +1 -1
- data/bin/ollama_cli +11 -6
- data/lib/ollama/version.rb +1 -1
- data/ollama-ruby.gemspec +3 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f22498af2b68b25f11d486872f46a42ad16b94244d3f0a9cb7df9e436056894
|
4
|
+
data.tar.gz: aa154d720f3df668020bdf39d38c7964e7081cabcfa4daec761ebb3809bfa57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32fb5d1bd7dd225c8917c8e43b43f9983eb85c971fbe01f4993f9b0131761d467a93658d2cf50ca5db1d44da6ea20ad6885aded8a5747ea259ab3d4c261c6b2
|
7
|
+
data.tar.gz: 067ca2f5c9c7de901732aae837dc151e023751a935952e4c0533dd50124610c367fc6149e16c096724077bb0c8f9f0781028f7dd108a32dfd4cdf1b533af9040
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2025-07-21 v1.5.0
|
4
|
+
|
5
|
+
* Update `ollama_cli` script to handle client configuration via JSON and
|
6
|
+
clarify argument types:
|
7
|
+
* Added support for `-c ` option to specify client configuration as JSON
|
8
|
+
* Updated documentation to clarify which arguments expect JSON input
|
9
|
+
* Replaced direct client initialization with `configure_with` method for
|
10
|
+
better maintainability
|
11
|
+
* Update documentation for `ollama_cli` script:
|
12
|
+
* Reorganized usage instructions for clarity
|
13
|
+
* Added descriptions for new options: `-c ` and `-H `
|
14
|
+
* Clarified which arguments expect JSON input:
|
15
|
+
- `-M OPTIONS`: model options in JSON format
|
16
|
+
- `-s SYSTEM` and `-p PROMPT`: plain text inputs
|
17
|
+
* Improved formatting for better readability
|
18
|
+
* Add `ollama_browse` to Rakefile executable tasks
|
19
|
+
|
3
20
|
## 2025-07-17 v1.4.0
|
4
21
|
|
5
22
|
* **New CLI Tool**: Added `bin/ollama_browse` for exploring model tags and
|
data/README.md
CHANGED
@@ -350,26 +350,22 @@ To use `ollama_cli`, simply run it from the command line and follow the usage
|
|
350
350
|
instructions:
|
351
351
|
|
352
352
|
```bash
|
353
|
-
ollama_cli [OPTIONS]
|
354
|
-
|
353
|
+
Usage: ollama_cli [OPTIONS]
|
354
|
+
|
355
|
+
-u URL the ollama base url, $OLLAMA_URL
|
356
|
+
-c CLIENT the ollama client config (JSON), $OLLAMA_CLIENT
|
357
|
+
-m MODEL the ollama model to chat with, $OLLAMA_MODEL
|
358
|
+
-M OPTIONS the ollama model options (JSON), $OLLAMA_MODEL_OPTIONS
|
359
|
+
-s SYSTEM the system prompt as plain text, $OLLAMA_SYSTEM
|
360
|
+
-p PROMPT the user prompt as plain text, $OLLAMA_PROMPT
|
361
|
+
if it contains %{stdin} it is substituted by stdin input
|
362
|
+
-P VARIABLE sets prompt var %{foo} to "bar" if VARIABLE is foo=bar
|
363
|
+
-H HANDLER the handler to use for the response, defaults to ChatStart
|
364
|
+
-S use streaming for generation
|
365
|
+
-T use thinking for generation
|
366
|
+
-h this help
|
355
367
|
|
356
|
-
|
357
|
-
|
358
|
-
* `-u URL`: The Ollama base URL. Can be set as an environment variable
|
359
|
-
`OLLAMA_URL`.
|
360
|
-
* `-m MODEL`: The Ollama model to chat with. Defaults to `llama3.1` if not
|
361
|
-
specified.
|
362
|
-
* `-M OPTIONS`: The Ollama model options to use. Can be set as an environment
|
363
|
-
variable `OLLAMA_MODEL_OPTIONS`.
|
364
|
-
* `-s SYSTEM`: The system prompt to use as a file. Can be set as an environment
|
365
|
-
variable `OLLAMA_SYSTEM`.
|
366
|
-
* `-p PROMPT`: The user prompt to use as a file. If it contains `%{stdin}`, it
|
367
|
-
will be substituted with the standard input. If not given, stdin will be used
|
368
|
-
as the prompt.
|
369
|
-
* `-P VARIABLE`: Sets a prompt variable, e.g. `foo=bar`. Can be used multiple
|
370
|
-
times.
|
371
|
-
* `-H HANDLER`: The handler to use for the response. Defaults to `Print`.
|
372
|
-
* `-S`: Use streaming for generation.
|
368
|
+
```
|
373
369
|
|
374
370
|
#### Environment Variables
|
375
371
|
|
@@ -377,10 +373,11 @@ The following environment variables can be set to customize the behavior of
|
|
377
373
|
`ollama_cli`:
|
378
374
|
|
379
375
|
* `OLLAMA_URL`: The Ollama base URL.
|
376
|
+
* `OLLAMA_CLIENT`: The client config (JSON).
|
380
377
|
* `OLLAMA_MODEL`: The Ollama model to chat with.
|
381
|
-
* `OLLAMA_MODEL_OPTIONS`: The Ollama model options
|
382
|
-
* `OLLAMA_SYSTEM`: The system prompt to use as
|
383
|
-
* `OLLAMA_PROMPT`: The user prompt to use as
|
378
|
+
* `OLLAMA_MODEL_OPTIONS`: The Ollama model options (JSON).
|
379
|
+
* `OLLAMA_SYSTEM`: The system prompt to use as plain text.
|
380
|
+
* `OLLAMA_PROMPT`: The user prompt to use as plain text.
|
384
381
|
|
385
382
|
#### Debug Mode
|
386
383
|
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ GemHadar do
|
|
19
19
|
'.rspec', *Dir.glob('.github/**/*', File::FNM_DOTMATCH)
|
20
20
|
readme 'README.md'
|
21
21
|
|
22
|
-
executables << 'ollama_console' << 'ollama_update' << 'ollama_cli'
|
22
|
+
executables << 'ollama_console' << 'ollama_update' << 'ollama_cli' << 'ollama_browse'
|
23
23
|
|
24
24
|
required_ruby_version '~> 3.1'
|
25
25
|
|
data/bin/ollama_cli
CHANGED
@@ -68,10 +68,11 @@ def usage
|
|
68
68
|
Usage: #{File.basename($0)} [OPTIONS]
|
69
69
|
|
70
70
|
-u URL the ollama base url, $OLLAMA_URL
|
71
|
+
-c CLIENT the ollama client config (JSON), $OLLAMA_CLIENT
|
71
72
|
-m MODEL the ollama model to chat with, $OLLAMA_MODEL
|
72
|
-
-M OPTIONS the ollama model options
|
73
|
-
-s SYSTEM the system prompt
|
74
|
-
-p PROMPT the user prompt
|
73
|
+
-M OPTIONS the ollama model options (JSON), $OLLAMA_MODEL_OPTIONS
|
74
|
+
-s SYSTEM the system prompt as plain text, $OLLAMA_SYSTEM
|
75
|
+
-p PROMPT the user prompt as plain text, $OLLAMA_PROMPT
|
75
76
|
if it contains %{stdin} it is substituted by stdin input
|
76
77
|
-P VARIABLE sets prompt var %{foo} to "bar" if VARIABLE is foo=bar
|
77
78
|
-H HANDLER the handler to use for the response, defaults to ChatStart
|
@@ -83,11 +84,15 @@ def usage
|
|
83
84
|
exit 0
|
84
85
|
end
|
85
86
|
|
86
|
-
opts = go 'u:m:M:s:p:P:H:STh', defaults: { ?H => 'ChatStart', ?M => '{}' }
|
87
|
+
opts = go 'u:m:M:s:p:P:H:c:STh', defaults: { ?H => 'ChatStart', ?M => '{}' }
|
87
88
|
|
88
89
|
opts[?h] and usage
|
89
90
|
|
90
|
-
base_url
|
91
|
+
base_url = opts[?u] || ENV['OLLAMA_URL'] || 'http://%s' % ENV.fetch('OLLAMA_HOST')
|
92
|
+
client_config = Client::Config[
|
93
|
+
{ base_url: } |
|
94
|
+
JSON(get_file_argument(opts[?c], default: ENV['OLLAMA_CLIENT']).full? || '{}')
|
95
|
+
]
|
91
96
|
model = opts[?m] || ENV.fetch('OLLAMA_MODEL', 'llama3.1')
|
92
97
|
options = Ollama::Options.from_hash(JSON(
|
93
98
|
get_file_argument(opts[?M], default: ENV['OLLAMA_MODEL_OPTIONS'])
|
@@ -127,7 +132,7 @@ handler = case
|
|
127
132
|
handler
|
128
133
|
end
|
129
134
|
|
130
|
-
Client.
|
135
|
+
Client.configure_with(client_config).generate(
|
131
136
|
model:,
|
132
137
|
system:,
|
133
138
|
prompt:,
|
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.5.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.5.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]
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.date = "1980-01-02"
|
12
12
|
s.description = "Library that allows interacting with the Ollama API".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
|
-
s.executables = ["ollama_console".freeze, "ollama_update".freeze, "ollama_cli".freeze]
|
14
|
+
s.executables = ["ollama_console".freeze, "ollama_update".freeze, "ollama_cli".freeze, "ollama_browse".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
16
|
s.files = [".yardopts".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_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
|
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
@@ -214,6 +214,7 @@ dependencies:
|
|
214
214
|
description: Library that allows interacting with the Ollama API
|
215
215
|
email: flori@ping.de
|
216
216
|
executables:
|
217
|
+
- ollama_browse
|
217
218
|
- ollama_cli
|
218
219
|
- ollama_console
|
219
220
|
- ollama_update
|