ollama-ruby 0.1.0 → 0.3.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 +105 -0
- data/README.md +14 -14
- data/Rakefile +3 -1
- data/bin/ollama_chat +181 -71
- data/bin/ollama_cli +68 -0
- data/bin/ollama_console +7 -2
- data/lib/ollama/documents/memory_cache.rb +4 -2
- data/lib/ollama/documents/redis_cache.rb +4 -3
- data/lib/ollama/documents.rb +30 -5
- data/lib/ollama/dto.rb +4 -7
- data/lib/ollama/options.rb +4 -0
- data/lib/ollama/utils/file_argument.rb +16 -0
- data/lib/ollama/utils/tags.rb +4 -0
- data/lib/ollama/utils/width.rb +14 -1
- data/lib/ollama/version.rb +1 -1
- data/lib/ollama.rb +1 -0
- data/ollama-ruby.gemspec +8 -7
- data/spec/ollama/client_spec.rb +2 -2
- data/spec/ollama/commands/chat_spec.rb +2 -2
- data/spec/ollama/commands/copy_spec.rb +2 -2
- data/spec/ollama/commands/create_spec.rb +2 -2
- data/spec/ollama/commands/delete_spec.rb +2 -2
- data/spec/ollama/commands/embed_spec.rb +3 -3
- data/spec/ollama/commands/embeddings_spec.rb +2 -2
- data/spec/ollama/commands/generate_spec.rb +2 -2
- data/spec/ollama/commands/pull_spec.rb +2 -2
- data/spec/ollama/commands/push_spec.rb +2 -2
- data/spec/ollama/commands/show_spec.rb +2 -2
- data/spec/ollama/documents/redis_cache_spec.rb +8 -0
- data/spec/ollama/documents_spec.rb +42 -0
- data/spec/ollama/message_spec.rb +3 -4
- data/spec/ollama/options_spec.rb +18 -0
- data/spec/ollama/tool_spec.rb +1 -6
- data/tmp/.keep +0 -0
- metadata +23 -3
data/spec/ollama/tool_spec.rb
CHANGED
@@ -45,23 +45,18 @@ RSpec.describe Ollama::Tool do
|
|
45
45
|
|
46
46
|
it 'cannot be converted to JSON' do
|
47
47
|
expect(tool.as_json).to eq(
|
48
|
-
json_class: described_class.name,
|
49
48
|
type: 'function',
|
50
49
|
function: {
|
51
|
-
json_class: "Ollama::Tool::Function",
|
52
50
|
name: 'get_current_weather',
|
53
51
|
description: "Get the current weather for a location",
|
54
52
|
parameters: {
|
55
|
-
json_class: "Ollama::Tool::Function::Parameters",
|
56
53
|
type: "object",
|
57
54
|
properties: {
|
58
55
|
location: {
|
59
|
-
json_class: "Ollama::Tool::Function::Parameters::Property",
|
60
56
|
type: "string",
|
61
57
|
description: "The location to get the weather for, e.g. Berlin, Berlin"
|
62
58
|
},
|
63
59
|
format: {
|
64
|
-
json_class: "Ollama::Tool::Function::Parameters::Property",
|
65
60
|
type: "string",
|
66
61
|
description: "The format to return the weather in, e.g. 'celsius' or 'fahrenheit'",
|
67
62
|
enum: ["celsius", "fahrenheit"]
|
@@ -72,7 +67,7 @@ RSpec.describe Ollama::Tool do
|
|
72
67
|
}
|
73
68
|
)
|
74
69
|
expect(tool.to_json).to eq(
|
75
|
-
%{{"
|
70
|
+
%{{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather for a location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The location to get the weather for, e.g. Berlin, Berlin"},"format":{"type":"string","description":"The format to return the weather in, e.g. 'celsius' or 'fahrenheit'","enum":["celsius","fahrenheit"]}},"required":["location","format"]}}}}
|
76
71
|
)
|
77
72
|
end
|
78
73
|
end
|
data/tmp/.keep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ollama-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -276,12 +276,27 @@ dependencies:
|
|
276
276
|
- - "~>"
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: 0.4.1
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: pdf-reader
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "~>"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '2.0'
|
286
|
+
type: :runtime
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - "~>"
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '2.0'
|
279
293
|
description: Library that allows interacting with the Ollama API
|
280
294
|
email: flori@ping.de
|
281
295
|
executables:
|
282
296
|
- ollama_console
|
283
297
|
- ollama_chat
|
284
298
|
- ollama_update
|
299
|
+
- ollama_cli
|
285
300
|
extensions: []
|
286
301
|
extra_rdoc_files:
|
287
302
|
- README.md
|
@@ -331,17 +346,20 @@ extra_rdoc_files:
|
|
331
346
|
- lib/ollama/utils/chooser.rb
|
332
347
|
- lib/ollama/utils/colorize_texts.rb
|
333
348
|
- lib/ollama/utils/fetcher.rb
|
349
|
+
- lib/ollama/utils/file_argument.rb
|
334
350
|
- lib/ollama/utils/math.rb
|
335
351
|
- lib/ollama/utils/tags.rb
|
336
352
|
- lib/ollama/utils/width.rb
|
337
353
|
- lib/ollama/version.rb
|
338
354
|
files:
|
339
355
|
- ".envrc"
|
356
|
+
- CHANGES.md
|
340
357
|
- Gemfile
|
341
358
|
- LICENSE
|
342
359
|
- README.md
|
343
360
|
- Rakefile
|
344
361
|
- bin/ollama_chat
|
362
|
+
- bin/ollama_cli
|
345
363
|
- bin/ollama_console
|
346
364
|
- bin/ollama_update
|
347
365
|
- config/redis.conf
|
@@ -392,6 +410,7 @@ files:
|
|
392
410
|
- lib/ollama/utils/chooser.rb
|
393
411
|
- lib/ollama/utils/colorize_texts.rb
|
394
412
|
- lib/ollama/utils/fetcher.rb
|
413
|
+
- lib/ollama/utils/file_argument.rb
|
395
414
|
- lib/ollama/utils/math.rb
|
396
415
|
- lib/ollama/utils/tags.rb
|
397
416
|
- lib/ollama/utils/width.rb
|
@@ -435,6 +454,7 @@ files:
|
|
435
454
|
- spec/ollama/utils/fetcher_spec.rb
|
436
455
|
- spec/ollama/utils/tags_spec.rb
|
437
456
|
- spec/spec_helper.rb
|
457
|
+
- tmp/.keep
|
438
458
|
homepage: https://github.com/flori/ollama-ruby
|
439
459
|
licenses:
|
440
460
|
- MIT
|
@@ -458,7 +478,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
458
478
|
- !ruby/object:Gem::Version
|
459
479
|
version: '0'
|
460
480
|
requirements: []
|
461
|
-
rubygems_version: 3.5.
|
481
|
+
rubygems_version: 3.5.18
|
462
482
|
signing_key:
|
463
483
|
specification_version: 4
|
464
484
|
summary: Interacting with the Ollama API
|