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.
data/bin/ollama_cli CHANGED
@@ -16,6 +16,8 @@ def usage
16
16
  -M OPTIONS the ollama model options to use, OLLAMA_MODEL_OPTIONS
17
17
  -s SYSTEM the system prompt to use as a file, OLLAMA_SYSTEM
18
18
  -p PROMPT the user prompt to use as a file, OLLAMA_PROMPT
19
+ if it contains %{stdin} it is substituted by stdin input
20
+ -P VARIABLE sets prompt var %{foo} to "bar" if VARIABLE is foo=bar
19
21
  -H HANDLER the handler to use for the response, defaults to Print
20
22
  -S use streaming for generation
21
23
  -h this help
@@ -24,7 +26,7 @@ def usage
24
26
  exit 0
25
27
  end
26
28
 
27
- opts = go 'u:m:M:s:p:H:Sh', defaults: { ?H => 'Print', ?M => '{}' }
29
+ opts = go 'u:m:M:s:p:P:H:Sh', defaults: { ?H => 'Print', ?M => '{}' }
28
30
 
29
31
  opts[?h] and usage
30
32
 
@@ -38,14 +40,14 @@ prompt = get_file_argument(opts[?p], default: ENV['OLLAMA_PROMPT'])
38
40
 
39
41
  if prompt.nil?
40
42
  prompt = STDIN.read
41
- elsif c = prompt.scan('%s').size
42
- case c
43
- when 0
44
- when 1
45
- prompt = prompt % STDIN.read
46
- else
47
- STDERR.puts "Found more than one plaeceholder %s. => Ignoring."
48
- end
43
+ else
44
+ vars = prompt.scan(/%\{([^}]+)\}/).inject([], &:concat).uniq.map(&:to_sym)
45
+ stdin = (STDIN.read if vars.include?(:stdin)).to_s
46
+ values = opts[?P].to_a.inject({ stdin: }) { |h, pair|
47
+ n, v = pair.split(?=, 2)
48
+ h.merge(n.to_sym => v)
49
+ }
50
+ prompt = prompt % values
49
51
  end
50
52
 
51
53
  if ENV['DEBUG'].to_i == 1
@@ -0,0 +1,17 @@
1
+ module Ollama::Documents::Cache::Common
2
+ attr_writer :prefix
3
+
4
+ def collections(prefix)
5
+ unique = Set.new
6
+ full_each { |key, _| unique << key[/\A#{prefix}(.*)-/, 1] }
7
+ unique.map(&:to_sym)
8
+ end
9
+
10
+ def pre(key)
11
+ [ @prefix, key ].join
12
+ end
13
+
14
+ def unpre(key)
15
+ key.sub(/\A#@prefix/, '')
16
+ end
17
+ end
@@ -1,11 +1,13 @@
1
+ require 'ollama/documents/cache/common'
2
+
1
3
  class Ollama::Documents::MemoryCache
4
+ include Ollama::Documents::Cache::Common
5
+
2
6
  def initialize(prefix:)
3
7
  @prefix = prefix
4
8
  @data = {}
5
9
  end
6
10
 
7
- attr_writer :prefix
8
-
9
11
  def [](key)
10
12
  @data[pre(key)]
11
13
  end
@@ -23,11 +25,11 @@ class Ollama::Documents::MemoryCache
23
25
  end
24
26
 
25
27
  def size
26
- @data.size
28
+ count
27
29
  end
28
30
 
29
31
  def clear
30
- @data.clear
32
+ @data.delete_if { |key, _| key.start_with?(@prefix) }
31
33
  self
32
34
  end
33
35
 
@@ -36,11 +38,7 @@ class Ollama::Documents::MemoryCache
36
38
  end
37
39
  include Enumerable
38
40
 
39
- def pre(key)
40
- [ @prefix, key ].join
41
- end
42
-
43
- def unpre(key)
44
- key.sub(/\A#@prefix/, '')
41
+ def full_each(&block)
42
+ @data.each(&block)
45
43
  end
46
44
  end
@@ -0,0 +1,38 @@
1
+ require 'redis'
2
+
3
+ class Ollama::Documents
4
+ class RedisBackedMemoryCache < MemoryCache
5
+ def initialize(prefix:, url: ENV['REDIS_URL'], object_class: nil)
6
+ super(prefix:)
7
+ url or raise ArgumentError, 'require redis url'
8
+ @prefix, @url, @object_class = prefix, url, object_class
9
+ @redis_cache = Ollama::Documents::RedisCache.new(prefix:, url:, object_class:)
10
+ @redis_cache.full_each do |key, value|
11
+ @data[key] = value
12
+ end
13
+ end
14
+
15
+ attr_reader :object_class
16
+
17
+ def redis
18
+ @redis_cache.redis
19
+ end
20
+
21
+ def []=(key, value)
22
+ super
23
+ redis.set(pre(key), JSON(value))
24
+ end
25
+
26
+ def delete(key)
27
+ result = redis.del(pre(key))
28
+ super
29
+ result
30
+ end
31
+
32
+ def clear
33
+ redis.scan_each(match: "#@prefix*") { |key| redis.del(key) }
34
+ super
35
+ self
36
+ end
37
+ end
38
+ end
@@ -1,12 +1,15 @@
1
+ require 'ollama/documents/cache/common'
1
2
  require 'redis'
2
3
 
3
4
  class Ollama::Documents::RedisCache
4
- def initialize(prefix:, url: ENV['REDIS_URL'])
5
+ include Ollama::Documents::Cache::Common
6
+
7
+ def initialize(prefix:, url: ENV['REDIS_URL'], object_class: nil, ex: nil)
5
8
  url or raise ArgumentError, 'require redis url'
6
- @prefix, @url = prefix, url
9
+ @prefix, @url, @object_class, @ex = prefix, url, object_class, ex
7
10
  end
8
11
 
9
- attr_writer :prefix
12
+ attr_reader :object_class
10
13
 
11
14
  def redis
12
15
  @redis ||= Redis.new(url: @url)
@@ -15,12 +18,16 @@ class Ollama::Documents::RedisCache
15
18
  def [](key)
16
19
  value = redis.get(pre(key))
17
20
  unless value.nil?
18
- JSON(value, object_class: Ollama::Documents::Record)
21
+ JSON(value, object_class:)
19
22
  end
20
23
  end
21
24
 
22
25
  def []=(key, value)
23
- redis.set(pre(key), JSON(value))
26
+ redis.set(pre(key), JSON.generate(value), ex: @ex)
27
+ end
28
+
29
+ def ttl(key)
30
+ redis.ttl(pre(key))
24
31
  end
25
32
 
26
33
  def key?(key)
@@ -48,11 +55,11 @@ class Ollama::Documents::RedisCache
48
55
  end
49
56
  include Enumerable
50
57
 
51
- def pre(key)
52
- [ @prefix, key ].join
53
- end
54
-
55
- def unpre(key)
56
- key.sub(/\A#@prefix/, '')
58
+ def full_each(&block)
59
+ redis.scan_each(match: [ Ollama::Documents, ?* ] * ?-) do |key|
60
+ value = redis.get(key) or next
61
+ value = JSON(value, object_class: Ollama::Documents::Record)
62
+ block.(key, value)
63
+ end
57
64
  end
58
65
  end
@@ -2,8 +2,9 @@ module Ollama::Documents::Splitters
2
2
  class Character
3
3
  DEFAULT_SEPARATOR = /(?:\r?\n){2,}/
4
4
 
5
- def initialize(separator: DEFAULT_SEPARATOR, include_separator: false, chunk_size: 4096)
6
- @separator, @include_separator, @chunk_size = separator, include_separator, chunk_size
5
+ def initialize(separator: DEFAULT_SEPARATOR, include_separator: false, combining_string: "\n\n", chunk_size: 4096)
6
+ @separator, @include_separator, @combining_string, @chunk_size =
7
+ separator, include_separator, combining_string, chunk_size
7
8
  if include_separator
8
9
  @separator = Regexp.new("(#@separator)")
9
10
  end
@@ -22,7 +23,7 @@ module Ollama::Documents::Splitters
22
23
  current_text = +''
23
24
  texts.each do |t|
24
25
  if current_text.size + t.size < @chunk_size
25
- current_text += t
26
+ current_text << t << @combining_string
26
27
  else
27
28
  current_text.empty? or result << current_text
28
29
  current_text = t
@@ -41,11 +42,11 @@ module Ollama::Documents::Splitters
41
42
  //,
42
43
  ].freeze
43
44
 
44
- def initialize(separators: DEFAULT_SEPARATORS, include_separator: false, chunk_size: 4096)
45
+ def initialize(separators: DEFAULT_SEPARATORS, include_separator: false, combining_string: "\n\n", chunk_size: 4096)
45
46
  separators.empty? and
46
47
  raise ArgumentError, "non-empty array of separators required"
47
- @separators, @include_separator, @chunk_size =
48
- separators, include_separator, chunk_size
48
+ @separators, @include_separator, @combining_string, @chunk_size =
49
+ separators, include_separator, combining_string, chunk_size
49
50
  end
50
51
 
51
52
  def split(text, separators: @separators)
@@ -55,6 +56,7 @@ module Ollama::Documents::Splitters
55
56
  texts = Character.new(
56
57
  separator:,
57
58
  include_separator: @include_separator,
59
+ combining_string: @combining_string,
58
60
  chunk_size: @chunk_size
59
61
  ).split(text)
60
62
  texts.count == 0 and return [ text ]
@@ -12,7 +12,7 @@ module Ollama::Documents::Splitters
12
12
  def split(text, batch_size: 100, breakpoint: :percentile, **opts)
13
13
  sentences = Ollama::Documents::Splitters::Character.new(
14
14
  separator: @separator,
15
- include_separator: true,
15
+ include_separator: opts.fetch(:include_separator, true),
16
16
  chunk_size: 1,
17
17
  ).split(text)
18
18
  embeddings = sentences.with_infobar(label: 'Split').each_slice(batch_size).inject([]) do |e, batch|
@@ -3,8 +3,11 @@ require 'digest'
3
3
 
4
4
  class Ollama::Documents
5
5
  end
6
- require 'ollama/documents/memory_cache'
7
- require 'ollama/documents/redis_cache'
6
+ class Ollama::Documents::Cache
7
+ end
8
+ require 'ollama/documents/cache/memory_cache'
9
+ require 'ollama/documents/cache/redis_cache'
10
+ require 'ollama/documents/cache/redis_backed_memory_cache'
8
11
  module Ollama::Documents::Splitters
9
12
  end
10
13
  require 'ollama/documents/splitters/character'
@@ -16,11 +19,15 @@ class Ollama::Documents
16
19
 
17
20
  class Record < JSON::GenericObject
18
21
  def to_s
19
- my_tags = Ollama::Utils::Tags.new(tags)
22
+ my_tags = tags_set
20
23
  my_tags.empty? or my_tags = " #{my_tags}"
21
24
  "#<#{self.class} #{text.inspect}#{my_tags} #{similarity || 'n/a'}>"
22
25
  end
23
26
 
27
+ def tags_set
28
+ Ollama::Utils::Tags.new(tags)
29
+ end
30
+
24
31
  def ==(other)
25
32
  text == other.text
26
33
  end
@@ -28,15 +35,22 @@ class Ollama::Documents
28
35
  alias inspect to_s
29
36
  end
30
37
 
31
- def initialize(ollama:, model:, model_options: nil, collection: :default, cache: MemoryCache, redis_url: nil)
32
- @ollama, @model, @model_options, @collection = ollama, model, model_options, collection
33
- @cache, @redis_url = connect_cache(cache), redis_url
38
+ def initialize(ollama:, model:, model_options: nil, collection: nil, cache: MemoryCache, redis_url: nil)
39
+ collection ||= default_collection
40
+ @ollama, @model, @model_options, @collection =
41
+ ollama, model, model_options, collection.to_sym
42
+ @redis_url = redis_url
43
+ @cache = connect_cache(cache)
34
44
  end
35
45
 
36
- attr_reader :ollama, :model, :collection
46
+ def default_collection
47
+ :default
48
+ end
49
+
50
+ attr_reader :ollama, :model, :collection, :cache
37
51
 
38
52
  def collection=(new_collection)
39
- @collection = new_collection
53
+ @collection = new_collection.to_sym
40
54
  @cache.prefix = prefix
41
55
  end
42
56
 
@@ -137,15 +151,7 @@ class Ollama::Documents
137
151
  end
138
152
 
139
153
  def collections
140
- case @cache
141
- when MemoryCache
142
- [ @collection ]
143
- when RedisCache
144
- prefix = '%s-' % self.class
145
- Documents::RedisCache.new(prefix:, url: @redis_url).map { _1[/#{prefix}(.*)-/, 1] }.uniq
146
- else
147
- []
148
- end
154
+ ([ default_collection ] + @cache.collections('%s-' % self.class)).uniq
149
155
  end
150
156
 
151
157
  def tags
@@ -156,9 +162,9 @@ class Ollama::Documents
156
162
 
157
163
  def connect_cache(cache_class)
158
164
  cache = nil
159
- if cache_class == RedisCache
165
+ if cache_class.instance_method(:redis)
160
166
  begin
161
- cache = cache_class.new(prefix:)
167
+ cache = cache_class.new(prefix:, url: @redis_url, object_class: Record)
162
168
  cache.size
163
169
  rescue Redis::CannotConnectError
164
170
  STDERR.puts(
@@ -3,11 +3,20 @@ class Ollama::Utils::ColorizeTexts
3
3
  include Term::ANSIColor
4
4
  include Ollama::Utils::Width
5
5
 
6
+ # Initializes a new instance of Ollama::Utils::ColorizeTexts
7
+ #
8
+ # @param [Array<String>] texts the array of strings to be displayed with colors
9
+ #
10
+ # @return [Ollama::Utils::ColorizeTexts] an instance of Ollama::Utils::ColorizeTexts
6
11
  def initialize(*texts)
7
- texts = texts.map(&:to_a)
12
+ texts = texts.map(&:to_a)
8
13
  @texts = Array(texts.flatten)
9
14
  end
10
15
 
16
+ # Returns a string representation of the object, including all texts content,
17
+ # colored differently and their sizes.
18
+ #
19
+ # @return [String] The formatted string.
11
20
  def to_s
12
21
  result = +''
13
22
  @texts.each_with_index do |t, i|
@@ -22,6 +31,14 @@ class Ollama::Utils::ColorizeTexts
22
31
 
23
32
  private
24
33
 
34
+ # Returns the nearest RGB color to the given ANSI color
35
+ #
36
+ # @param [color] color The ANSI color attribute
37
+ #
38
+ # @return [Array<RGBTriple>] An array containing two RGB colors, one for black and
39
+ # one for white text, where the first is the closest match to the input color
40
+ # when printed on a black background, and the second is the closest match
41
+ # when printed on a white background.
25
42
  def text_color(color)
26
43
  color = Term::ANSIColor::Attribute[color]
27
44
  [
@@ -30,6 +47,9 @@ class Ollama::Utils::ColorizeTexts
30
47
  ].max_by { |t| t.distance_to(color) }
31
48
  end
32
49
 
50
+ # Returns an array of colors for each step in the gradient
51
+ #
52
+ # @return [Array<Array<Integer>>] An array of RGB color arrays
33
53
  def colors
34
54
  @colors ||= (0..255).map { |i|
35
55
  [
@@ -2,21 +2,34 @@ require 'tempfile'
2
2
  require 'tins/unit'
3
3
  require 'infobar'
4
4
  require 'mime-types'
5
+ require 'stringio'
5
6
 
6
7
  class Ollama::Utils::Fetcher
7
8
  module ContentType
8
9
  attr_accessor :content_type
10
+
11
+ def self.failed
12
+ object = StringIO.new.extend(self)
13
+ object.content_type = MIME::Types['text/plain'].first
14
+ object
15
+ end
9
16
  end
10
17
 
11
18
  class RetryWithoutStreaming < StandardError; end
12
19
 
13
- def initialize
14
- @started = false
15
- @streaming = true
20
+ def initialize(debug: false, http_options: {})
21
+ @debug = debug
22
+ @started = false
23
+ @streaming = true
24
+ @http_options = http_options
25
+ end
26
+
27
+ def self.get(url, **options, &block)
28
+ new(**options).get(url, &block)
16
29
  end
17
30
 
18
- def self.get(url, &block)
19
- new.get(url, &block)
31
+ def excon(url, **options)
32
+ Excon.new(url, options.merge(@http_options))
20
33
  end
21
34
 
22
35
  def get(url, &block)
@@ -24,13 +37,13 @@ class Ollama::Utils::Fetcher
24
37
  Tempfile.open do |tmp|
25
38
  infobar.label = 'Getting'
26
39
  if @streaming
27
- response = Excon.get(url, headers:, response_block: callback(tmp))
40
+ response = excon(url, headers:, response_block: callback(tmp)).request(method: :get)
28
41
  response.status != 200 || !@started and raise RetryWithoutStreaming
29
42
  decorate_io(tmp, response)
30
43
  infobar.finish
31
44
  block.(tmp)
32
45
  else
33
- response = Excon.get(url, headers:, middlewares:)
46
+ response = excon(url, headers:, middlewares:).request(method: :get)
34
47
  if response.status != 200
35
48
  raise "invalid response status code"
36
49
  end
@@ -46,11 +59,11 @@ class Ollama::Utils::Fetcher
46
59
  @streaming = false
47
60
  retry
48
61
  rescue => e
49
- STDERR.puts "Cannot get #{url.to_s.inspect} (#{e}): #{response&.status_line}"
50
- unless e.is_a?(RuntimeError)
62
+ STDERR.puts "Cannot get #{url.to_s.inspect} (#{e}): #{response&.status_line || 'n/a'}"
63
+ if @debug && !e.is_a?(RuntimeError)
51
64
  STDERR.puts "#{e.backtrace * ?\n}"
52
65
  end
53
- yield nil
66
+ yield ContentType.failed
54
67
  end
55
68
 
56
69
  def headers
@@ -102,4 +115,24 @@ class Ollama::Utils::Fetcher
102
115
  end
103
116
  end
104
117
  end
118
+
119
+ def self.execute(command, &block)
120
+ Tempfile.open do |tmp|
121
+ IO.popen(command) do |command|
122
+ until command.eof?
123
+ tmp.write command.read(4096)
124
+ end
125
+ tmp.rewind
126
+ tmp.extend(Ollama::Utils::Fetcher::ContentType)
127
+ tmp.content_type = MIME::Types['text/plain'].first
128
+ block.(tmp)
129
+ end
130
+ end
131
+ rescue => e
132
+ STDERR.puts "Cannot execute #{command.inspect} (#{e})"
133
+ if @debug && !e.is_a?(RuntimeError)
134
+ STDERR.puts "#{e.backtrace * ?\n}"
135
+ end
136
+ yield ContentType.failed
137
+ end
105
138
  end
@@ -1,16 +1,32 @@
1
1
  module Ollama::Utils::FileArgument
2
2
  module_function
3
3
 
4
+ # Returns the contents of a file or string, or a default value if neither is provided.
5
+ #
6
+ # @param [String] path_or_content The path to a file or a string containing
7
+ # the content.
8
+ #
9
+ # @param [String] default The default value to return if no valid input is
10
+ # given. Defaults to nil.
11
+ #
12
+ # @return [String] The contents of the file, the string, or the default value.
13
+ #
14
+ # @example Get the contents of a file
15
+ # get_file_argument('path/to/file')
16
+ #
17
+ # @example Use a string as content
18
+ # get_file_argument('string content')
19
+ #
20
+ # @example Return a default value if no valid input is given
21
+ # get_file_argument(nil, default: 'default content')
4
22
  def get_file_argument(path_or_content, default: nil)
5
23
  if path_or_content.present? && path_or_content.size < 2 ** 15 &&
6
24
  File.basename(path_or_content).size < 2 ** 8 &&
7
25
  File.exist?(path_or_content)
8
- then
26
+ then
9
27
  File.read(path_or_content)
10
- elsif path_or_content.present?
11
- path_or_content
12
28
  else
13
- default
29
+ path_or_content.full? || default
14
30
  end
15
31
  end
16
32
  end
@@ -1,5 +1,6 @@
1
1
  require 'sorted_set'
2
2
 
3
+
3
4
  class Ollama::Utils::Tags < SortedSet
4
5
  def to_a
5
6
  super.map(&:to_s)
@@ -1,6 +1,6 @@
1
1
  module Ollama
2
2
  # Ollama version
3
- VERSION = '0.3.2'
3
+ VERSION = '0.5.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
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'logger'
2
3
  require 'excon'
3
4
 
4
5
  module Ollama
data/ollama-ruby.gemspec CHANGED
@@ -1,33 +1,35 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama-ruby 0.3.2 ruby lib
2
+ # stub: ollama-ruby 0.5.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama-ruby".freeze
6
- s.version = "0.3.2".freeze
6
+ s.version = "0.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]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2024-09-15"
11
+ s.date = "2024-09-26"
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_chat".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/documents.rb".freeze, "lib/ollama/documents/memory_cache.rb".freeze, "lib/ollama/documents/redis_cache.rb".freeze, "lib/ollama/documents/splitters/character.rb".freeze, "lib/ollama/documents/splitters/semantic.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/utils/ansi_markdown.rb".freeze, "lib/ollama/utils/chooser.rb".freeze, "lib/ollama/utils/colorize_texts.rb".freeze, "lib/ollama/utils/fetcher.rb".freeze, "lib/ollama/utils/file_argument.rb".freeze, "lib/ollama/utils/math.rb".freeze, "lib/ollama/utils/tags.rb".freeze, "lib/ollama/utils/width.rb".freeze, "lib/ollama/version.rb".freeze]
16
- s.files = [".envrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_cli".freeze, "bin/ollama_console".freeze, "bin/ollama_update".freeze, "config/redis.conf".freeze, "docker-compose.yml".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/documents.rb".freeze, "lib/ollama/documents/memory_cache.rb".freeze, "lib/ollama/documents/redis_cache.rb".freeze, "lib/ollama/documents/splitters/character.rb".freeze, "lib/ollama/documents/splitters/semantic.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/utils/ansi_markdown.rb".freeze, "lib/ollama/utils/chooser.rb".freeze, "lib/ollama/utils/colorize_texts.rb".freeze, "lib/ollama/utils/fetcher.rb".freeze, "lib/ollama/utils/file_argument.rb".freeze, "lib/ollama/utils/math.rb".freeze, "lib/ollama/utils/tags.rb".freeze, "lib/ollama/utils/width.rb".freeze, "lib/ollama/version.rb".freeze, "ollama-ruby.gemspec".freeze, "spec/assets/embeddings.json".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".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/documents/memory_cache_spec.rb".freeze, "spec/ollama/documents/redis_cache_spec.rb".freeze, "spec/ollama/documents/splitters/character_spec.rb".freeze, "spec/ollama/documents/splitters/semantic_spec.rb".freeze, "spec/ollama/documents_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/ollama/utils/ansi_markdown_spec.rb".freeze, "spec/ollama/utils/fetcher_spec.rb".freeze, "spec/ollama/utils/file_argument_spec.rb".freeze, "spec/ollama/utils/tags_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/documents.rb".freeze, "lib/ollama/documents/cache/common.rb".freeze, "lib/ollama/documents/cache/memory_cache.rb".freeze, "lib/ollama/documents/cache/redis_backed_memory_cache.rb".freeze, "lib/ollama/documents/cache/redis_cache.rb".freeze, "lib/ollama/documents/splitters/character.rb".freeze, "lib/ollama/documents/splitters/semantic.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/utils/ansi_markdown.rb".freeze, "lib/ollama/utils/chooser.rb".freeze, "lib/ollama/utils/colorize_texts.rb".freeze, "lib/ollama/utils/fetcher.rb".freeze, "lib/ollama/utils/file_argument.rb".freeze, "lib/ollama/utils/math.rb".freeze, "lib/ollama/utils/tags.rb".freeze, "lib/ollama/utils/width.rb".freeze, "lib/ollama/version.rb".freeze]
16
+ s.files = [".envrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_cli".freeze, "bin/ollama_console".freeze, "bin/ollama_update".freeze, "config/redis.conf".freeze, "docker-compose.yml".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/documents.rb".freeze, "lib/ollama/documents/cache/common.rb".freeze, "lib/ollama/documents/cache/memory_cache.rb".freeze, "lib/ollama/documents/cache/redis_backed_memory_cache.rb".freeze, "lib/ollama/documents/cache/redis_cache.rb".freeze, "lib/ollama/documents/splitters/character.rb".freeze, "lib/ollama/documents/splitters/semantic.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/utils/ansi_markdown.rb".freeze, "lib/ollama/utils/chooser.rb".freeze, "lib/ollama/utils/colorize_texts.rb".freeze, "lib/ollama/utils/fetcher.rb".freeze, "lib/ollama/utils/file_argument.rb".freeze, "lib/ollama/utils/math.rb".freeze, "lib/ollama/utils/tags.rb".freeze, "lib/ollama/utils/width.rb".freeze, "lib/ollama/version.rb".freeze, "ollama-ruby.gemspec".freeze, "spec/assets/embeddings.json".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".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/documents/memory_cache_spec.rb".freeze, "spec/ollama/documents/redis_backed_memory_cache_spec.rb".freeze, "spec/ollama/documents/redis_cache_spec.rb".freeze, "spec/ollama/documents/splitters/character_spec.rb".freeze, "spec/ollama/documents/splitters/semantic_spec.rb".freeze, "spec/ollama/documents_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/ollama/utils/ansi_markdown_spec.rb".freeze, "spec/ollama/utils/fetcher_spec.rb".freeze, "spec/ollama/utils/file_argument_spec.rb".freeze, "spec/ollama/utils/tags_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.5.18".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/documents/memory_cache_spec.rb".freeze, "spec/ollama/documents/redis_cache_spec.rb".freeze, "spec/ollama/documents/splitters/character_spec.rb".freeze, "spec/ollama/documents/splitters/semantic_spec.rb".freeze, "spec/ollama/documents_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/ollama/utils/ansi_markdown_spec.rb".freeze, "spec/ollama/utils/fetcher_spec.rb".freeze, "spec/ollama/utils/file_argument_spec.rb".freeze, "spec/ollama/utils/tags_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/documents/memory_cache_spec.rb".freeze, "spec/ollama/documents/redis_backed_memory_cache_spec.rb".freeze, "spec/ollama/documents/redis_cache_spec.rb".freeze, "spec/ollama/documents/splitters/character_spec.rb".freeze, "spec/ollama/documents/splitters/semantic_spec.rb".freeze, "spec/ollama/documents_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/ollama/utils/ansi_markdown_spec.rb".freeze, "spec/ollama/utils/fetcher_spec.rb".freeze, "spec/ollama/utils/file_argument_spec.rb".freeze, "spec/ollama/utils/tags_spec.rb".freeze, "spec/spec_helper.rb".freeze]
24
24
 
25
25
  s.specification_version = 4
26
26
 
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.17.1".freeze])
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.18.0".freeze])
28
28
  s.add_development_dependency(%q<all_images>.freeze, ["~> 0.4".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.2".freeze])
30
30
  s.add_development_dependency(%q<webmock>.freeze, [">= 0".freeze])
31
+ s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
32
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
31
33
  s.add_runtime_dependency(%q<excon>.freeze, ["~> 0.111".freeze])
32
34
  s.add_runtime_dependency(%q<infobar>.freeze, ["~> 0.8".freeze])
33
35
  s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.11".freeze])
@@ -43,4 +45,6 @@ Gem::Specification.new do |s|
43
45
  s.add_runtime_dependency(%q<search_ui>.freeze, ["~> 0.0".freeze])
44
46
  s.add_runtime_dependency(%q<amatch>.freeze, ["~> 0.4.1".freeze])
45
47
  s.add_runtime_dependency(%q<pdf-reader>.freeze, ["~> 2.0".freeze])
48
+ s.add_runtime_dependency(%q<logger>.freeze, ["~> 1.0".freeze])
49
+ s.add_runtime_dependency(%q<json>.freeze, ["~> 2.0".freeze])
46
50
  end