ollama-ruby 0.3.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +131 -0
- data/README.md +21 -16
- data/Rakefile +6 -1
- data/bin/ollama_chat +303 -168
- data/bin/ollama_cli +11 -9
- data/lib/ollama/documents/cache/common.rb +17 -0
- data/lib/ollama/documents/{memory_cache.rb → cache/memory_cache.rb} +8 -10
- data/lib/ollama/documents/cache/redis_backed_memory_cache.rb +38 -0
- data/lib/ollama/documents/{redis_cache.rb → cache/redis_cache.rb} +18 -11
- data/lib/ollama/documents/splitters/character.rb +8 -6
- data/lib/ollama/documents/splitters/semantic.rb +1 -1
- data/lib/ollama/documents.rb +25 -19
- data/lib/ollama/utils/colorize_texts.rb +21 -1
- data/lib/ollama/utils/fetcher.rb +43 -10
- data/lib/ollama/utils/file_argument.rb +20 -4
- data/lib/ollama/utils/tags.rb +1 -0
- data/lib/ollama/version.rb +1 -1
- data/lib/ollama.rb +1 -0
- data/ollama-ruby.gemspec +11 -7
- data/spec/ollama/documents/memory_cache_spec.rb +16 -16
- data/spec/ollama/documents/redis_backed_memory_cache_spec.rb +106 -0
- data/spec/ollama/documents/redis_cache_spec.rb +36 -16
- data/spec/ollama/documents/splitters/character_spec.rb +28 -14
- data/spec/ollama/utils/fetcher_spec.rb +42 -1
- metadata +70 -8
@@ -1,63 +1,63 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Ollama::Documents::MemoryCache do
|
4
|
-
let :
|
4
|
+
let :cache do
|
5
5
|
described_class.new prefix: 'test-'
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'can be instantiated' do
|
9
|
-
expect(
|
9
|
+
expect(cache).to be_a described_class
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'can get/set a key' do
|
13
13
|
key, value = 'foo', { test: true }
|
14
14
|
expect {
|
15
|
-
|
15
|
+
cache[key] = value
|
16
16
|
}.to change {
|
17
|
-
|
17
|
+
cache[key]
|
18
18
|
}.from(nil).to(value)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'can determine if key exists' do
|
22
22
|
key, value = 'foo', { test: true }
|
23
23
|
expect {
|
24
|
-
|
24
|
+
cache[key] = value
|
25
25
|
}.to change {
|
26
|
-
|
26
|
+
cache.key?(key)
|
27
27
|
}.from(false).to(true)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'can delete' do
|
31
31
|
key, value = 'foo', { test: true }
|
32
|
-
|
32
|
+
cache[key] = value
|
33
33
|
expect {
|
34
|
-
|
34
|
+
cache.delete(key)
|
35
35
|
}.to change {
|
36
|
-
|
36
|
+
cache.key?(key)
|
37
37
|
}.from(true).to(false)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'returns size' do
|
41
41
|
key, value = 'foo', { test: true }
|
42
42
|
expect {
|
43
|
-
|
43
|
+
cache[key] = value
|
44
44
|
}.to change {
|
45
|
-
|
45
|
+
cache.size
|
46
46
|
}.from(0).to(1)
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'can clear' do
|
50
50
|
key, value = 'foo', { test: true }
|
51
|
-
|
51
|
+
cache[key] = value
|
52
52
|
expect {
|
53
|
-
expect(
|
53
|
+
expect(cache.clear).to eq cache
|
54
54
|
}.to change {
|
55
|
-
|
55
|
+
cache.size
|
56
56
|
}.from(1).to(0)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'can iterate over keys under a prefix' do
|
60
|
-
|
61
|
-
expect(
|
60
|
+
cache['foo'] = 'bar'
|
61
|
+
expect(cache.to_a).to eq [ %w[ test-foo bar ] ]
|
62
62
|
end
|
63
63
|
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Ollama::Documents::RedisBackedMemoryCache do
|
4
|
+
it 'raises ArgumentError if url is missing' do
|
5
|
+
expect {
|
6
|
+
described_class.new prefix: 'test-', url: nil
|
7
|
+
}.to raise_error ArgumentError
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'test redis interactions' do
|
11
|
+
let :cache do
|
12
|
+
described_class.new prefix: 'test-', url: 'something'
|
13
|
+
end
|
14
|
+
|
15
|
+
let :data do
|
16
|
+
cache.instance_eval { @data }
|
17
|
+
end
|
18
|
+
|
19
|
+
let :redis_cache do
|
20
|
+
cache.instance_eval { @redis_cache }
|
21
|
+
end
|
22
|
+
|
23
|
+
let :redis do
|
24
|
+
double('Redis')
|
25
|
+
end
|
26
|
+
|
27
|
+
before do
|
28
|
+
allow_any_instance_of(Ollama::Documents::RedisCache).to\
|
29
|
+
receive(:redis).and_return(redis)
|
30
|
+
allow(redis).to receive(:scan_each)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'can be instantiated and initialized' do
|
34
|
+
cache = described_class.new prefix: 'test-', url: 'something'
|
35
|
+
expect(cache).to be_a described_class
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'defaults to nil object_class' do
|
39
|
+
cache = described_class.new prefix: 'test-', url: 'something'
|
40
|
+
expect(cache.object_class).to be_nil
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'can be configured with object_class' do
|
44
|
+
object_class = Class.new(JSON::GenericObject)
|
45
|
+
cache = described_class.new(prefix: 'test-', url: 'something', object_class:)
|
46
|
+
expect(cache.object_class).to eq object_class
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'has Redis client' do
|
50
|
+
expect(cache.redis).to eq redis
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'can get a key' do
|
54
|
+
key = 'foo'
|
55
|
+
expect(data).to receive(:[]).with('test-' + key).and_return 666
|
56
|
+
expect(cache[key]).to eq 666
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'can set a value for a key' do
|
60
|
+
key, value = 'foo', { test: true }
|
61
|
+
expect(data).to receive(:[]=).with('test-' + key, { test: true }).and_call_original
|
62
|
+
expect(redis).to receive(:set).with('test-' + key, JSON(value))
|
63
|
+
cache[key] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can determine if key exists' do
|
67
|
+
key = 'foo'
|
68
|
+
expect(data).to receive(:key?).with('test-' + key).and_return(false, true)
|
69
|
+
expect(cache.key?('foo')).to eq false
|
70
|
+
expect(cache.key?('foo')).to eq true
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'can delete' do
|
74
|
+
key = 'foo'
|
75
|
+
expect(data).to receive(:delete).with('test-' + key)
|
76
|
+
expect(redis).to receive(:del).with('test-' + key)
|
77
|
+
cache.delete(key)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'returns size' do
|
81
|
+
allow(cache).to receive(:count).and_return 3
|
82
|
+
expect(cache.size).to eq 3
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can clear' do
|
86
|
+
expect(redis).to receive(:scan_each).with(match: 'test-*').and_yield(
|
87
|
+
'test-foo'
|
88
|
+
)
|
89
|
+
expect(redis).to receive(:del).with('test-foo')
|
90
|
+
expect(cache.clear).to eq cache
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'can iterate over keys under a prefix' do
|
94
|
+
data['test-foo'] = 'bar'
|
95
|
+
expect(cache.to_a).to eq [ %w[ test-foo bar ] ]
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'can compute prefix with pre' do
|
99
|
+
expect(cache.pre('foo')).to eq 'test-foo'
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'can remove prefix with unpre' do
|
103
|
+
expect(cache.unpre('test-foo')).to eq 'foo'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -2,8 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe Ollama::Documents::RedisCache do
|
4
4
|
it 'can be instantiated' do
|
5
|
-
|
6
|
-
expect(
|
5
|
+
cache = described_class.new prefix: 'test-', url: 'something'
|
6
|
+
expect(cache).to be_a described_class
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'defaults to nil object_class' do
|
10
|
+
cache = described_class.new prefix: 'test-', url: 'something'
|
11
|
+
expect(cache.object_class).to be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'can be configured with object_class' do
|
15
|
+
object_class = Class.new(JSON::GenericObject)
|
16
|
+
cache = described_class.new(prefix: 'test-', url: 'something', object_class:)
|
17
|
+
expect(cache.object_class).to eq object_class
|
7
18
|
end
|
8
19
|
|
9
20
|
it 'raises ArgumentError if url is missing' do
|
@@ -13,7 +24,7 @@ RSpec.describe Ollama::Documents::RedisCache do
|
|
13
24
|
end
|
14
25
|
|
15
26
|
context 'test redis interactions' do
|
16
|
-
let :
|
27
|
+
let :cache do
|
17
28
|
described_class.new prefix: 'test-', url: 'something'
|
18
29
|
end
|
19
30
|
|
@@ -26,32 +37,41 @@ RSpec.describe Ollama::Documents::RedisCache do
|
|
26
37
|
end
|
27
38
|
|
28
39
|
it 'has Redis client' do
|
29
|
-
expect(
|
40
|
+
expect(cache.redis).to eq redis
|
30
41
|
end
|
31
42
|
|
32
43
|
it 'can get a key' do
|
33
44
|
key = 'foo'
|
34
|
-
expect(redis).to receive(:get).with('test-' + key).and_return
|
35
|
-
|
45
|
+
expect(redis).to receive(:get).with('test-' + key).and_return '"some_json"'
|
46
|
+
expect(cache[key]).to eq 'some_json'
|
36
47
|
end
|
37
48
|
|
38
49
|
it 'can set a value for a key' do
|
39
50
|
key, value = 'foo', { test: true }
|
40
|
-
expect(redis).to receive(:set).with('test-' + key, JSON(value))
|
41
|
-
|
51
|
+
expect(redis).to receive(:set).with('test-' + key, JSON(value), ex: nil)
|
52
|
+
cache[key] = value
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'can set a value for a key with ttl' do
|
56
|
+
cache = described_class.new prefix: 'test-', url: 'something', ex: 3_600
|
57
|
+
key, value = 'foo', { test: true }
|
58
|
+
expect(redis).to receive(:set).with('test-' + key, JSON(value), ex: 3_600)
|
59
|
+
cache[key] = value
|
60
|
+
allow(redis).to receive(:ttl).with('test-' + key).and_return 3_600
|
61
|
+
expect(cache.ttl(key)).to eq 3_600
|
42
62
|
end
|
43
63
|
|
44
64
|
it 'can determine if key exists' do
|
45
65
|
key = 'foo'
|
46
66
|
expect(redis).to receive(:exists?).with('test-' + key).and_return(false, true)
|
47
|
-
expect(
|
48
|
-
expect(
|
67
|
+
expect(cache.key?('foo')).to eq false
|
68
|
+
expect(cache.key?('foo')).to eq true
|
49
69
|
end
|
50
70
|
|
51
71
|
it 'can delete' do
|
52
72
|
key = 'foo'
|
53
73
|
expect(redis).to receive(:del).with('test-' + key)
|
54
|
-
|
74
|
+
cache.delete(key)
|
55
75
|
end
|
56
76
|
|
57
77
|
it 'returns size' do
|
@@ -59,7 +79,7 @@ RSpec.describe Ollama::Documents::RedisCache do
|
|
59
79
|
and_yield('test-foo').
|
60
80
|
and_yield('test-bar').
|
61
81
|
and_yield('test-baz')
|
62
|
-
expect(
|
82
|
+
expect(cache.size).to eq 3
|
63
83
|
end
|
64
84
|
|
65
85
|
it 'can clear' do
|
@@ -67,20 +87,20 @@ RSpec.describe Ollama::Documents::RedisCache do
|
|
67
87
|
'test-foo'
|
68
88
|
)
|
69
89
|
expect(redis).to receive(:del).with('test-foo')
|
70
|
-
expect(
|
90
|
+
expect(cache.clear).to eq cache
|
71
91
|
end
|
72
92
|
|
73
93
|
it 'can iterate over keys under a prefix' do
|
74
94
|
expect(redis).to receive(:scan_each).with(match: 'test-*')
|
75
|
-
|
95
|
+
cache.to_a
|
76
96
|
end
|
77
97
|
|
78
98
|
it 'can compute prefix with pre' do
|
79
|
-
expect(
|
99
|
+
expect(cache.pre('foo')).to eq 'test-foo'
|
80
100
|
end
|
81
101
|
|
82
102
|
it 'can remove prefix with unpre' do
|
83
|
-
expect(
|
103
|
+
expect(cache.unpre('test-foo')).to eq 'foo'
|
84
104
|
end
|
85
105
|
end
|
86
106
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe Ollama::Documents::Splitters::Character do
|
4
4
|
let :splitter do
|
5
|
-
described_class.new chunk_size: 23
|
5
|
+
described_class.new chunk_size: 23, combining_string: ''
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'can be instantiated' do
|
@@ -10,29 +10,41 @@ RSpec.describe Ollama::Documents::Splitters::Character do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'can split' do
|
13
|
-
text = [
|
13
|
+
text = [ ?A * 10 ] * 10 * "\n\n"
|
14
14
|
result = splitter.split(text)
|
15
15
|
expect(result.count).to eq 5
|
16
16
|
expect(result.to_a.join('')).to eq ?A * 100
|
17
17
|
end
|
18
18
|
|
19
|
+
it 'can split combining with separation' do
|
20
|
+
splitter = described_class.new chunk_size: 25, include_separator: false,
|
21
|
+
combining_string: ?X
|
22
|
+
text = [ ?A * 10 ] * 10 * "\n\n"
|
23
|
+
result = splitter.split(text)
|
24
|
+
expect(result.count).to eq 5
|
25
|
+
expect(result.to_a.join(?B)).to eq\
|
26
|
+
"AAAAAAAAAAXAAAAAAAAAAXBAAAAAAAAAAAAAAAAAAAAXBAAAAAAAAAAAAAAAAAAAAXB"\
|
27
|
+
"AAAAAAAAAAAAAAAAAAAAXBAAAAAAAAAAAAAAAAAAAAX"
|
28
|
+
end
|
29
|
+
|
19
30
|
it 'can split including separator' do
|
20
|
-
splitter = described_class.new chunk_size: 25, include_separator: true
|
21
|
-
|
31
|
+
splitter = described_class.new chunk_size: 25, include_separator: true,
|
32
|
+
combining_string: ''
|
33
|
+
text = [ ?A * 10 ] * 10 * "\n\n"
|
22
34
|
result = splitter.split(text)
|
23
35
|
expect(result.count).to eq 5
|
24
36
|
expect(result.to_a.join('')).to eq text
|
25
37
|
end
|
26
38
|
|
27
39
|
it 'cannot split' do
|
28
|
-
text = [
|
40
|
+
text = [ ?A * 10 ] * 10 * "\n"
|
29
41
|
result = splitter.split(text)
|
30
42
|
expect(result.count).to eq 1
|
31
43
|
expect(result.to_a.join('').count(?A)).to eq text.count(?A)
|
32
44
|
end
|
33
45
|
|
34
46
|
it 'cannot split2' do
|
35
|
-
text =
|
47
|
+
text = ?A * 25
|
36
48
|
result = splitter.split(text)
|
37
49
|
expect(result.count).to eq 1
|
38
50
|
expect(result.to_a.join('')).to eq ?A * 25
|
@@ -48,7 +60,7 @@ end
|
|
48
60
|
|
49
61
|
RSpec.describe Ollama::Documents::Splitters::RecursiveCharacter do
|
50
62
|
let :splitter do
|
51
|
-
described_class.new chunk_size: 23
|
63
|
+
described_class.new chunk_size: 23, combining_string: ''
|
52
64
|
end
|
53
65
|
|
54
66
|
it 'can be instantiated' do
|
@@ -56,7 +68,7 @@ RSpec.describe Ollama::Documents::Splitters::RecursiveCharacter do
|
|
56
68
|
end
|
57
69
|
|
58
70
|
it 'can split' do
|
59
|
-
text = [
|
71
|
+
text = [ ?A * 10 ] * 10 * "\n\n"
|
60
72
|
result = splitter.split(text)
|
61
73
|
expect(result.count).to eq 5
|
62
74
|
expect(result.to_a.join('')).to eq ?A * 100
|
@@ -65,30 +77,32 @@ RSpec.describe Ollama::Documents::Splitters::RecursiveCharacter do
|
|
65
77
|
it 'cannot split' do
|
66
78
|
splitter = described_class.new chunk_size: 23, include_separator: true,
|
67
79
|
separators: described_class::DEFAULT_SEPARATORS[0..-2]
|
68
|
-
text =
|
80
|
+
text = ?A * 25
|
69
81
|
result = splitter.split(text)
|
70
82
|
expect(result.count).to eq 1
|
71
83
|
expect(result.to_a.join('')).to eq ?A * 25
|
72
84
|
end
|
73
85
|
|
74
86
|
it 'can split including separator' do
|
75
|
-
splitter = described_class.new chunk_size: 25, include_separator: true
|
76
|
-
|
87
|
+
splitter = described_class.new chunk_size: 25, include_separator: true,
|
88
|
+
combining_string: ''
|
89
|
+
text = [ ?A * 10 ] * 10 * "\n\n"
|
77
90
|
result = splitter.split(text)
|
78
91
|
expect(result.count).to eq 5
|
79
92
|
expect(result.to_a.join('')).to eq text
|
80
93
|
end
|
81
94
|
|
82
95
|
it 'can split single newline as well' do
|
83
|
-
text = [
|
96
|
+
text = [ ?A * 10 ] * 10 * "\n"
|
84
97
|
result = splitter.split(text)
|
85
98
|
expect(result.count).to eq 5
|
86
99
|
expect(result.to_a.join('')).to eq ?A * 100
|
87
100
|
end
|
88
101
|
|
89
102
|
it 'can split single newline as well including separator' do
|
90
|
-
splitter = described_class.new chunk_size: 25, include_separator: true
|
91
|
-
|
103
|
+
splitter = described_class.new chunk_size: 25, include_separator: true,
|
104
|
+
combining_string: ''
|
105
|
+
text = [ ?A * 10 ] * 10 * "\n"
|
92
106
|
result = splitter.split(text)
|
93
107
|
expect(result.count).to eq 5
|
94
108
|
expect(result.to_a.join('')).to eq text
|
@@ -33,6 +33,28 @@ RSpec.describe Ollama::Utils::Fetcher do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'can #get without ssl peer verification' do
|
37
|
+
fetcher = described_class.new(
|
38
|
+
http_options: { ssl_verify_peer: false }
|
39
|
+
)
|
40
|
+
stub_request(:get, 'https://www.example.com/hello').
|
41
|
+
with(headers: fetcher.headers).
|
42
|
+
to_return(
|
43
|
+
status: 200,
|
44
|
+
body: 'world',
|
45
|
+
headers: { 'Content-Type' => 'text/plain' },
|
46
|
+
)
|
47
|
+
expect(Excon).to receive(:new).with(
|
48
|
+
'https://www.example.com/hello',
|
49
|
+
hash_including(ssl_verify_peer: false)
|
50
|
+
).and_call_original
|
51
|
+
fetcher.get(url) do |tmp|
|
52
|
+
expect(tmp).to be_a Tempfile
|
53
|
+
expect(tmp.read).to eq 'world'
|
54
|
+
expect(tmp.content_type).to eq 'text/plain'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
36
58
|
it 'can #get and fallback from streaming' do
|
37
59
|
stub_request(:get, 'https://www.example.com/hello').
|
38
60
|
with(headers: fetcher.headers).
|
@@ -56,7 +78,9 @@ RSpec.describe Ollama::Utils::Fetcher do
|
|
56
78
|
with(headers: fetcher.headers).
|
57
79
|
to_return(status: 500)
|
58
80
|
fetcher.get(url) do |tmp|
|
59
|
-
expect(tmp).to
|
81
|
+
expect(tmp).to be_a StringIO
|
82
|
+
expect(tmp.read).to eq ''
|
83
|
+
expect(tmp.content_type).to eq 'text/plain'
|
60
84
|
end
|
61
85
|
end
|
62
86
|
|
@@ -71,4 +95,21 @@ RSpec.describe Ollama::Utils::Fetcher do
|
|
71
95
|
expect(file.content_type).to eq 'application/x-ruby'
|
72
96
|
end
|
73
97
|
end
|
98
|
+
|
99
|
+
it 'can .execute' do
|
100
|
+
described_class.execute('echo -n hello world') do |file|
|
101
|
+
expect(file).to be_a Tempfile
|
102
|
+
expect(file.read).to eq 'hello world'
|
103
|
+
expect(file.content_type).to eq 'text/plain'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'can .execute and fail' do
|
108
|
+
allow(IO).to receive(:popen).and_raise StandardError
|
109
|
+
described_class.execute('foobar') do |file|
|
110
|
+
expect(file).to be_a StringIO
|
111
|
+
expect(file.read).to be_empty
|
112
|
+
expect(file.content_type).to eq 'text/plain'
|
113
|
+
end
|
114
|
+
end
|
74
115
|
end
|
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.5.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-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.18.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.18.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: all_images
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: debug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: excon
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +304,34 @@ dependencies:
|
|
276
304
|
- - "~>"
|
277
305
|
- !ruby/object:Gem::Version
|
278
306
|
version: '2.0'
|
307
|
+
- !ruby/object:Gem::Dependency
|
308
|
+
name: logger
|
309
|
+
requirement: !ruby/object:Gem::Requirement
|
310
|
+
requirements:
|
311
|
+
- - "~>"
|
312
|
+
- !ruby/object:Gem::Version
|
313
|
+
version: '1.0'
|
314
|
+
type: :runtime
|
315
|
+
prerelease: false
|
316
|
+
version_requirements: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - "~>"
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '1.0'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: json
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - "~>"
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '2.0'
|
328
|
+
type: :runtime
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - "~>"
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '2.0'
|
279
335
|
description: Library that allows interacting with the Ollama API
|
280
336
|
email: flori@ping.de
|
281
337
|
executables:
|
@@ -303,8 +359,10 @@ extra_rdoc_files:
|
|
303
359
|
- lib/ollama/commands/show.rb
|
304
360
|
- lib/ollama/commands/tags.rb
|
305
361
|
- lib/ollama/documents.rb
|
306
|
-
- lib/ollama/documents/
|
307
|
-
- lib/ollama/documents/
|
362
|
+
- lib/ollama/documents/cache/common.rb
|
363
|
+
- lib/ollama/documents/cache/memory_cache.rb
|
364
|
+
- lib/ollama/documents/cache/redis_backed_memory_cache.rb
|
365
|
+
- lib/ollama/documents/cache/redis_cache.rb
|
308
366
|
- lib/ollama/documents/splitters/character.rb
|
309
367
|
- lib/ollama/documents/splitters/semantic.rb
|
310
368
|
- lib/ollama/dto.rb
|
@@ -367,8 +425,10 @@ files:
|
|
367
425
|
- lib/ollama/commands/show.rb
|
368
426
|
- lib/ollama/commands/tags.rb
|
369
427
|
- lib/ollama/documents.rb
|
370
|
-
- lib/ollama/documents/
|
371
|
-
- lib/ollama/documents/
|
428
|
+
- lib/ollama/documents/cache/common.rb
|
429
|
+
- lib/ollama/documents/cache/memory_cache.rb
|
430
|
+
- lib/ollama/documents/cache/redis_backed_memory_cache.rb
|
431
|
+
- lib/ollama/documents/cache/redis_cache.rb
|
372
432
|
- lib/ollama/documents/splitters/character.rb
|
373
433
|
- lib/ollama/documents/splitters/semantic.rb
|
374
434
|
- lib/ollama/dto.rb
|
@@ -420,6 +480,7 @@ files:
|
|
420
480
|
- spec/ollama/commands/show_spec.rb
|
421
481
|
- spec/ollama/commands/tags_spec.rb
|
422
482
|
- spec/ollama/documents/memory_cache_spec.rb
|
483
|
+
- spec/ollama/documents/redis_backed_memory_cache_spec.rb
|
423
484
|
- spec/ollama/documents/redis_cache_spec.rb
|
424
485
|
- spec/ollama/documents/splitters/character_spec.rb
|
425
486
|
- spec/ollama/documents/splitters/semantic_spec.rb
|
@@ -486,6 +547,7 @@ test_files:
|
|
486
547
|
- spec/ollama/commands/show_spec.rb
|
487
548
|
- spec/ollama/commands/tags_spec.rb
|
488
549
|
- spec/ollama/documents/memory_cache_spec.rb
|
550
|
+
- spec/ollama/documents/redis_backed_memory_cache_spec.rb
|
489
551
|
- spec/ollama/documents/redis_cache_spec.rb
|
490
552
|
- spec/ollama/documents/splitters/character_spec.rb
|
491
553
|
- spec/ollama/documents/splitters/semantic_spec.rb
|