ollama-ruby 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +1 -0
  3. data/README.md +67 -27
  4. data/Rakefile +16 -4
  5. data/bin/ollama_chat +422 -89
  6. data/bin/ollama_console +3 -3
  7. data/bin/ollama_update +17 -0
  8. data/config/redis.conf +5 -0
  9. data/docker-compose.yml +11 -0
  10. data/lib/ollama/client/doc.rb +2 -1
  11. data/lib/ollama/client.rb +7 -2
  12. data/lib/ollama/commands/embed.rb +4 -4
  13. data/lib/ollama/documents/memory_cache.rb +44 -0
  14. data/lib/ollama/documents/redis_cache.rb +57 -0
  15. data/lib/ollama/documents/splitters/character.rb +70 -0
  16. data/lib/ollama/documents/splitters/semantic.rb +90 -0
  17. data/lib/ollama/documents.rb +172 -0
  18. data/lib/ollama/handlers/progress.rb +18 -5
  19. data/lib/ollama/image.rb +16 -7
  20. data/lib/ollama/utils/chooser.rb +30 -0
  21. data/lib/ollama/utils/colorize_texts.rb +42 -0
  22. data/lib/ollama/utils/fetcher.rb +105 -0
  23. data/lib/ollama/utils/math.rb +48 -0
  24. data/lib/ollama/utils/tags.rb +7 -0
  25. data/lib/ollama/version.rb +1 -1
  26. data/lib/ollama.rb +12 -5
  27. data/ollama-ruby.gemspec +18 -8
  28. data/spec/assets/embeddings.json +1 -0
  29. data/spec/ollama/client_spec.rb +15 -15
  30. data/spec/ollama/commands/chat_spec.rb +2 -2
  31. data/spec/ollama/commands/copy_spec.rb +2 -2
  32. data/spec/ollama/commands/create_spec.rb +2 -2
  33. data/spec/ollama/commands/delete_spec.rb +2 -2
  34. data/spec/ollama/commands/embed_spec.rb +4 -3
  35. data/spec/ollama/commands/embeddings_spec.rb +2 -2
  36. data/spec/ollama/commands/generate_spec.rb +2 -2
  37. data/spec/ollama/commands/ps_spec.rb +2 -2
  38. data/spec/ollama/commands/pull_spec.rb +2 -2
  39. data/spec/ollama/commands/push_spec.rb +2 -2
  40. data/spec/ollama/commands/show_spec.rb +2 -2
  41. data/spec/ollama/commands/tags_spec.rb +2 -2
  42. data/spec/ollama/documents/memory_cache_spec.rb +63 -0
  43. data/spec/ollama/documents/redis_cache_spec.rb +78 -0
  44. data/spec/ollama/documents/splitters/character_spec.rb +96 -0
  45. data/spec/ollama/documents/splitters/semantic_spec.rb +56 -0
  46. data/spec/ollama/documents_spec.rb +119 -0
  47. data/spec/ollama/handlers/progress_spec.rb +2 -2
  48. data/spec/ollama/image_spec.rb +4 -0
  49. data/spec/ollama/utils/fetcher_spec.rb +74 -0
  50. data/spec/ollama/utils/tags_spec.rb +24 -0
  51. data/spec/spec_helper.rb +8 -0
  52. metadata +184 -4
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.0.0
4
+ version: 0.1.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-08-12 00:00:00.000000000 Z
11
+ date: 2024-08-30 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.16.1
19
+ version: 1.17.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.16.1
26
+ version: 1.17.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: all_images
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
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'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: excon
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -136,11 +150,138 @@ dependencies:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
152
  version: '3.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: redis
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '5.0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '5.0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: numo-narray
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.9'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.9'
181
+ - !ruby/object:Gem::Dependency
182
+ name: more_math
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.1'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.1'
195
+ - !ruby/object:Gem::Dependency
196
+ name: sorted_set
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '1.0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '1.0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: mime-types
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '3.0'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '3.0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: reverse_markdown
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '2.0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '2.0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: complex_config
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '0.20'
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '0.20'
251
+ - !ruby/object:Gem::Dependency
252
+ name: search_ui
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: '0.0'
258
+ type: :runtime
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: '0.0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: amatch
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: 0.4.1
272
+ type: :runtime
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - "~>"
277
+ - !ruby/object:Gem::Version
278
+ version: 0.4.1
139
279
  description: Library that allows interacting with the Ollama API
140
280
  email: flori@ping.de
141
281
  executables:
142
282
  - ollama_console
143
283
  - ollama_chat
284
+ - ollama_update
144
285
  extensions: []
145
286
  extra_rdoc_files:
146
287
  - README.md
@@ -160,6 +301,11 @@ extra_rdoc_files:
160
301
  - lib/ollama/commands/push.rb
161
302
  - lib/ollama/commands/show.rb
162
303
  - lib/ollama/commands/tags.rb
304
+ - lib/ollama/documents.rb
305
+ - lib/ollama/documents/memory_cache.rb
306
+ - lib/ollama/documents/redis_cache.rb
307
+ - lib/ollama/documents/splitters/character.rb
308
+ - lib/ollama/documents/splitters/semantic.rb
163
309
  - lib/ollama/dto.rb
164
310
  - lib/ollama/errors.rb
165
311
  - lib/ollama/handlers.rb
@@ -182,15 +328,24 @@ extra_rdoc_files:
182
328
  - lib/ollama/tool/function/parameters.rb
183
329
  - lib/ollama/tool/function/parameters/property.rb
184
330
  - lib/ollama/utils/ansi_markdown.rb
331
+ - lib/ollama/utils/chooser.rb
332
+ - lib/ollama/utils/colorize_texts.rb
333
+ - lib/ollama/utils/fetcher.rb
334
+ - lib/ollama/utils/math.rb
335
+ - lib/ollama/utils/tags.rb
185
336
  - lib/ollama/utils/width.rb
186
337
  - lib/ollama/version.rb
187
338
  files:
339
+ - ".envrc"
188
340
  - Gemfile
189
341
  - LICENSE
190
342
  - README.md
191
343
  - Rakefile
192
344
  - bin/ollama_chat
193
345
  - bin/ollama_console
346
+ - bin/ollama_update
347
+ - config/redis.conf
348
+ - docker-compose.yml
194
349
  - lib/ollama.rb
195
350
  - lib/ollama/client.rb
196
351
  - lib/ollama/client/command.rb
@@ -207,6 +362,11 @@ files:
207
362
  - lib/ollama/commands/push.rb
208
363
  - lib/ollama/commands/show.rb
209
364
  - lib/ollama/commands/tags.rb
365
+ - lib/ollama/documents.rb
366
+ - lib/ollama/documents/memory_cache.rb
367
+ - lib/ollama/documents/redis_cache.rb
368
+ - lib/ollama/documents/splitters/character.rb
369
+ - lib/ollama/documents/splitters/semantic.rb
210
370
  - lib/ollama/dto.rb
211
371
  - lib/ollama/errors.rb
212
372
  - lib/ollama/handlers.rb
@@ -229,9 +389,15 @@ files:
229
389
  - lib/ollama/tool/function/parameters.rb
230
390
  - lib/ollama/tool/function/parameters/property.rb
231
391
  - lib/ollama/utils/ansi_markdown.rb
392
+ - lib/ollama/utils/chooser.rb
393
+ - lib/ollama/utils/colorize_texts.rb
394
+ - lib/ollama/utils/fetcher.rb
395
+ - lib/ollama/utils/math.rb
396
+ - lib/ollama/utils/tags.rb
232
397
  - lib/ollama/utils/width.rb
233
398
  - lib/ollama/version.rb
234
399
  - ollama-ruby.gemspec
400
+ - spec/assets/embeddings.json
235
401
  - spec/assets/kitten.jpg
236
402
  - spec/ollama/client/doc_spec.rb
237
403
  - spec/ollama/client_spec.rb
@@ -247,6 +413,11 @@ files:
247
413
  - spec/ollama/commands/push_spec.rb
248
414
  - spec/ollama/commands/show_spec.rb
249
415
  - spec/ollama/commands/tags_spec.rb
416
+ - spec/ollama/documents/memory_cache_spec.rb
417
+ - spec/ollama/documents/redis_cache_spec.rb
418
+ - spec/ollama/documents/splitters/character_spec.rb
419
+ - spec/ollama/documents/splitters/semantic_spec.rb
420
+ - spec/ollama/documents_spec.rb
250
421
  - spec/ollama/handlers/collector_spec.rb
251
422
  - spec/ollama/handlers/dump_json_spec.rb
252
423
  - spec/ollama/handlers/dump_yaml_spec.rb
@@ -261,6 +432,8 @@ files:
261
432
  - spec/ollama/options_spec.rb
262
433
  - spec/ollama/tool_spec.rb
263
434
  - spec/ollama/utils/ansi_markdown_spec.rb
435
+ - spec/ollama/utils/fetcher_spec.rb
436
+ - spec/ollama/utils/tags_spec.rb
264
437
  - spec/spec_helper.rb
265
438
  homepage: https://github.com/flori/ollama-ruby
266
439
  licenses:
@@ -304,6 +477,11 @@ test_files:
304
477
  - spec/ollama/commands/push_spec.rb
305
478
  - spec/ollama/commands/show_spec.rb
306
479
  - spec/ollama/commands/tags_spec.rb
480
+ - spec/ollama/documents/memory_cache_spec.rb
481
+ - spec/ollama/documents/redis_cache_spec.rb
482
+ - spec/ollama/documents/splitters/character_spec.rb
483
+ - spec/ollama/documents/splitters/semantic_spec.rb
484
+ - spec/ollama/documents_spec.rb
307
485
  - spec/ollama/handlers/collector_spec.rb
308
486
  - spec/ollama/handlers/dump_json_spec.rb
309
487
  - spec/ollama/handlers/dump_yaml_spec.rb
@@ -318,4 +496,6 @@ test_files:
318
496
  - spec/ollama/options_spec.rb
319
497
  - spec/ollama/tool_spec.rb
320
498
  - spec/ollama/utils/ansi_markdown_spec.rb
499
+ - spec/ollama/utils/fetcher_spec.rb
500
+ - spec/ollama/utils/tags_spec.rb
321
501
  - spec/spec_helper.rb