ollama_chat 0.0.63 → 0.0.65

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d207c29d7838f0cb8bb885dfc93038d2c246eb63d829d0af2e0cdef4c404d3f
4
- data.tar.gz: 3b70df18f2d302506614a56556ec0f98d2e814a3558a7bc141b73cc0716c5158
3
+ metadata.gz: 93d007af4b92cbca56b9738f9b2121d460bcff227beaee8f97b8a3fafd362797
4
+ data.tar.gz: e29f2db240c9d232e98e1381c3ef56b34db959d93fe2a15035e0ca55c85bc372
5
5
  SHA512:
6
- metadata.gz: 9b2647b7371490991e879f6f48682a7e7e2a2c3d7ab0fafd41fc7275cd204f9bb288b0ca0e8b11d5be9b0c23b54c93d141e418f0495ce4782de2b0165df1a703
7
- data.tar.gz: 83fa7ff6da22352d5d5af335e98975d423641ab3969e51f311068fd0912f4fb3494c22058c1a66e892cf1d11574cc705d9dc3c714ef50123ad555ca67011311b
6
+ metadata.gz: d914de741cbcb653a8a937b0ab298249be6ea3a933e609de96ec5c4ba87d9faa55cc65577f8ebec31b4b6f43927e8b33d245ad3bab82a1a5e48d155522370983
7
+ data.tar.gz: 052d95396af6f76ec7c8978d4cc2e70117aa7cf55ad922dc0454a3fa2b54ddf5d2ee621060fc9ab53837949ca89c4edbf8c6b549e7c56806a974ddd909308871
data/CHANGES.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-02-10 v0.0.65
4
+
5
+ - Updated `location_handling.rb` to return only `location_name`,
6
+ `location_decimal_degrees`, and `units`
7
+ - Removed `localtime` from `location_data` and prompt template in
8
+ `lib/ollama_chat/location_handling.rb`
9
+ - Updated `default_config.yml` location prompt to exclude `on %{localtime}`
10
+ - Simplified location switch messages in `switches.rb`
11
+ - Added new tool `GetTime` in `lib/ollama_chat/tools/get_time.rb` returning
12
+ ISO8601 time
13
+ - Updated `tools.rb` to require `get_time`
14
+ - Updated `tools/get_location.rb` comments and description
15
+ - Added `get_time_spec.rb` to `test_files` listing
16
+ - Added `get_time.rb` to `extra_rdoc_files` and `files` listings
17
+ - Removed duplicate `get_time.rb` entries from `extra_rdoc_files` and `files`
18
+ listings
19
+ - Updated specs: `message_list_spec.rb`, `tools/get_location_spec.rb`, added
20
+ `tools/get_time_spec.rb`
21
+ - Adjusted regexes in specs to match new prompt format
22
+ - Removed unused `time` field from `location_data` in tests
23
+
24
+ ## 2026-02-09 v0.0.64
25
+
26
+ - Added new `OllamaChat::Tools::GetJiraIssue` tool for fetching JIRA issue
27
+ information
28
+ - Introduced `ConfigMissingError` exception for handling missing configuration
29
+ - Added JIRA tool configuration in `OllamaChat::EnvConfig` with `URL`, `USER`,
30
+ and `API_TOKEN` settings
31
+ - Updated `default_config.yml` to include `get_jira_issue` tool with `default:
32
+ false`
33
+ - Enhanced `OllamaChat::Utils::Fetcher` to support additional options and
34
+ middleware
35
+ - Added comprehensive tests for the new `get_jira_issue` tool in
36
+ `spec/ollama_chat/tools/get_jira_issue_spec.rb`
37
+ - Updated tool registration to include the new `get_jira_issue` tool
38
+
3
39
  ## 2026-02-09 v0.0.63
4
40
 
5
41
  - Added `OllamaChat::Utils::PathValidator` module with `assert_valid_path`
@@ -140,11 +140,33 @@ module OllamaChat
140
140
  module TOOLS
141
141
  description 'Tool specific configuration settings'
142
142
 
143
+ # Run Tests tool configuration
143
144
  RUN_TESTS_TEST_RUNNER = set do
144
145
  description 'Configured test runner for run_tests tool function'
145
146
  default 'rspec'
146
147
  required true
147
148
  end
149
+
150
+ module JIRA
151
+ description 'Jira tool configuration'
152
+
153
+ URL = set do
154
+ description 'Base URL for Jira instance'
155
+ sensitive true
156
+ end
157
+
158
+ USER = set do
159
+ description 'Username for Jira authentication'
160
+ sensitive true
161
+ required { OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA::URL? }
162
+ end
163
+
164
+ API_TOKEN = set do
165
+ description 'API token for Jira authentication'
166
+ sensitive true
167
+ required { OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA::URL? }
168
+ end
169
+ end
148
170
  end
149
171
  end
150
172
  end
@@ -6,10 +6,6 @@
6
6
  # voice synthesis for spoken responses. It acts as a handler for streaming
7
7
  # responses and ensures proper formatting and display of both regular content
8
8
  # and thinking annotations.
9
- #
10
- # @example Processing a chat response
11
- # follow_chat = OllamaChat::FollowChat.new(chat: chat_instance, messages: message_list)
12
- # follow_chat.tool_call(response)
13
9
  class OllamaChat::FollowChat
14
10
  include Ollama
15
11
  include Ollama::Handlers::Concern
@@ -6,7 +6,7 @@
6
6
  # configuration to provide contextual location information to language models.
7
7
  #
8
8
  # @example Generating location information
9
- # chat.location_data # => { location_name: "New York", location_decimal_degrees: "40.7128, -74.0060", localtime: "2023-10-15T10:30:00Z", units: "metric" }
9
+ # chat.location_data # => { location_name: "New York", location_decimal_degrees: "40.7128, -74.0060", units: "metric" }
10
10
  # chat.location_description # => "Current location: New York (40.7128, -74.0060) at 2023-10-15T10:30:00Z in metric units"
11
11
  #
12
12
  # @see OllamaChat::Chat
@@ -15,7 +15,7 @@ module OllamaChat::LocationHandling
15
15
  # data.
16
16
  #
17
17
  # This method creates a formatted string containing location information
18
- # including name, coordinates, local time, and units, using the configured
18
+ # including name, coordinates, local and units, using the configured
19
19
  # location prompt template.
20
20
  #
21
21
  # @return [String] a formatted location description string
@@ -27,18 +27,16 @@ module OllamaChat::LocationHandling
27
27
  # Generates a hash containing current location data.
28
28
  #
29
29
  # This method collects and returns structured location information including
30
- # the location name, decimal degrees coordinates, local time, and units.
30
+ # the location name, decimal degrees coordinates, and units.
31
31
  #
32
32
  # @return [Hash] a hash containing location data with keys:
33
33
  # - location_name: The name of the location
34
34
  # - location_decimal_degrees: Comma-separated decimal degrees coordinates
35
- # - localtime: Current local time in ISO 8601 format
36
35
  # - units: The unit system (metric, imperial, etc.)
37
36
  def location_data
38
37
  {
39
38
  location_name: config.location.name,
40
39
  location_decimal_degrees: config.location.decimal_degrees * ', ',
41
- localtime: Time.now.iso8601,
42
40
  units: config.location.units,
43
41
  }
44
42
  end
@@ -30,7 +30,7 @@ prompts:
30
30
  Answer the the query %{query} using these summarized sources:
31
31
 
32
32
  %{results}
33
- location: You are at %{location_name}, %{location_decimal_degrees}, on %{localtime}, preferring %{units}
33
+ location: You are at %{location_name}, %{location_decimal_degrees}, preferring %{units}
34
34
  system_prompts:
35
35
  default: <%= OllamaChat::EnvConfig::OLLAMA::CHAT::SYSTEM || 'null' %>
36
36
  assistant: You are a helpful assistant.
@@ -94,6 +94,8 @@ tools:
94
94
  get_endoflife:
95
95
  url: "https://endoflife.date/api/v1/products/%{product}"
96
96
  default: false
97
+ get_time:
98
+ default: true
97
99
  get_location:
98
100
  default: true
99
101
  file_context:
@@ -140,3 +142,5 @@ tools:
140
142
  run_tests:
141
143
  require_confirmation: true
142
144
  default: true
145
+ get_jira_issue:
146
+ default: false
@@ -240,8 +240,8 @@ module OllamaChat::Switches
240
240
  @location = Switch.new(
241
241
  value: config.location.enabled,
242
242
  msg: {
243
- true => "Location and localtime enabled.",
244
- false => "Location and localtime disabled.",
243
+ true => "Location enabled.",
244
+ false => "Location disabled.",
245
245
  }
246
246
  )
247
247
  end
@@ -0,0 +1,74 @@
1
+ # A tool for fetching JIRA issue information.
2
+ #
3
+ # This tool allows the chat client to retrieve JIRA issue details by key.
4
+ # It integrates with the Ollama tool calling system to provide project
5
+ # management information to the language model.
6
+ class OllamaChat::Tools::GetJiraIssue
7
+ include OllamaChat::Tools::Concern
8
+
9
+ def self.register_name = 'get_jira_issue'
10
+
11
+ # Creates and returns a tool definition for getting JIRA issue information.
12
+ #
13
+ # This method constructs the function signature that describes what the tool
14
+ # does, its parameters, and required fields. The tool expects a JIRA issue key
15
+ # parameter to be provided.
16
+ #
17
+ # @return [Ollama::Tool] a tool definition for retrieving JIRA issue information
18
+ def tool
19
+ Tool.new(
20
+ type: 'function',
21
+ function: Tool::Function.new(
22
+ name:,
23
+ description: 'Get the JIRA issue for key as JSON',
24
+ parameters: Tool::Function::Parameters.new(
25
+ type: 'object',
26
+ properties: {
27
+ issue_key: Tool::Function::Parameters::Property.new(
28
+ type: 'string',
29
+ description: 'The JIRA issue key to get'
30
+ ),
31
+ },
32
+ required: %w[issue_key]
33
+ )
34
+ )
35
+ )
36
+ end
37
+
38
+ # Executes the JIRA lookup operation.
39
+ #
40
+ # This method fetches JIRA issue data from the configured API endpoint using
41
+ # the provided issue key. It handles the HTTP request, parses the JSON response,
42
+ # and returns the structured data.
43
+ #
44
+ # @param tool_call [Ollama::Tool::Call] the tool call object containing function details
45
+ # @param opts [Hash] additional options
46
+ # @option opts [ComplexConfig::Settings] :config the configuration object
47
+ # @return [String] the parsed JIRA issue data or an error message as JSON string
48
+ def execute(tool_call, **opts)
49
+ issue_key = tool_call.function.arguments.issue_key
50
+ fetch_issue(issue_key)
51
+ rescue => e
52
+ { error: e.class, message: e.message }.to_json
53
+ end
54
+
55
+ def fetch_issue(issue_key)
56
+ # Construct the JIRA API URL
57
+ env = OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA
58
+ base_url = env::URL? or raise OllamaChat::ConfigMissingError, 'need … URL'
59
+ url = "#{base_url}/rest/api/3/issue/#{issue_key}"
60
+
61
+ # Fetch the data from JIRA API
62
+ fetcher = OllamaChat::Utils::Fetcher.new(
63
+ debug: OllamaChat::EnvConfig::OLLAMA::CHAT::DEBUG,
64
+ )
65
+ fetcher.get(
66
+ url,
67
+ user: env::USER,
68
+ password: env::API_TOKEN,
69
+ &valid_json?
70
+ )
71
+ end
72
+
73
+ self
74
+ end.register
@@ -1,11 +1,11 @@
1
- # A tool for retrieving the current location, time, and system of units.
1
+ # A tool for retrieving the current location, and system of units.
2
2
  #
3
3
  # This tool allows the chat client to get the current location information,
4
- # including time and system of units for the user. It integrates with the
5
- # Ollama tool calling system to provide contextual location data to the language model.
4
+ # and system of units for the user. It integrates with the Ollama tool calling
5
+ # system to provide contextual location data to the language model.
6
6
  #
7
- # The tool returns structured JSON data containing location coordinates, time,
8
- # and unit system information.
7
+ # The tool returns structured JSON data containing location coordinates, and
8
+ # unit system information.
9
9
  class OllamaChat::Tools::GetLocation
10
10
  include OllamaChat::Tools::Concern
11
11
 
@@ -28,7 +28,7 @@ class OllamaChat::Tools::GetLocation
28
28
  type: 'function',
29
29
  function: Tool::Function.new(
30
30
  name:,
31
- description: 'Get the current location, time and system of units of the user as JSON',
31
+ description: 'Get the current location and system of units of the user as JSON',
32
32
  parameters: Tool::Function::Parameters.new(
33
33
  type: 'object',
34
34
  properties: {},
@@ -0,0 +1,49 @@
1
+ require 'time'
2
+
3
+ # get_time.rb – a tool that returns the current time as an ISO8601 string.
4
+ #
5
+ # This file mirrors the structure of get_location.rb and can be dropped into
6
+ # the `lib/ollama_chat/tools` directory. The tool is registered with the
7
+ # Ollama tool‑calling system and can be invoked by name `get_time`.
8
+ #
9
+ # Usage in a chat session:
10
+ # ollama_chat.run('get_time')
11
+ # # => "{\"time\":\"2026-02-09T14:32:00+01:00\"}"
12
+ #
13
+ # The implementation is intentionally lightweight – it simply calls
14
+ # `Time.now.iso8601` and serialises the result as JSON.
15
+ module OllamaChat
16
+ module Tools
17
+ class GetTime
18
+ include OllamaChat::Tools::Concern
19
+
20
+ # Register the tool name for the Ollama tool‑calling system.
21
+ def self.register_name = 'get_time'
22
+
23
+ # Build the function signature for the tool. No parameters are
24
+ # required – the tool simply returns the current time.
25
+ def tool
26
+ Tool.new(
27
+ type: 'function',
28
+ function: Tool::Function.new(
29
+ name:,
30
+ description: 'Get the current time as an ISO8601 string',
31
+ parameters: Tool::Function::Parameters.new(
32
+ type: 'object',
33
+ properties: {},
34
+ required: []
35
+ )
36
+ )
37
+ )
38
+ end
39
+
40
+ # Execute the tool. We return a JSON string containing the time
41
+ # in ISO8601 format. The caller can parse it as needed.
42
+ def execute(_tool_call, **_opts)
43
+ { time: Time.now.iso8601 }.to_json
44
+ end
45
+
46
+ self
47
+ end.register
48
+ end
49
+ end
@@ -48,7 +48,9 @@ require 'ollama_chat/tools/gem_path_lookup'
48
48
  require 'ollama_chat/tools/get_current_weather'
49
49
  require 'ollama_chat/tools/get_cve'
50
50
  require 'ollama_chat/tools/get_endoflife'
51
+ require 'ollama_chat/tools/get_jira_issue'
51
52
  require 'ollama_chat/tools/get_location'
53
+ require 'ollama_chat/tools/get_time'
52
54
  require 'ollama_chat/tools/import_url'
53
55
  require 'ollama_chat/tools/read_file'
54
56
  require 'ollama_chat/tools/run_tests'
@@ -185,23 +185,6 @@ class OllamaChat::Utils::Fetcher
185
185
  @http_options = http_options
186
186
  end
187
187
 
188
- private
189
-
190
- # The excon method creates a new Excon client instance configured with the
191
- # specified URL and options.
192
- #
193
- # @param url [ String ] the URL to be used for the Excon client
194
- # @param options [ Hash ] additional options to be merged with http_options
195
- #
196
- # @return [ Excon ] a new Excon client instance
197
- #
198
- # @see #normalize_url
199
- # @see #http_options
200
- def excon(url, **options)
201
- url = self.class.normalize_url(url)
202
- Excon.new(url, options.merge(@http_options))
203
- end
204
-
205
188
  # Makes an HTTP GET request to the specified URL with optional headers and
206
189
  # processing block.
207
190
  #
@@ -211,24 +194,25 @@ class OllamaChat::Utils::Fetcher
211
194
  # being passed to the provided block.
212
195
  #
213
196
  # @param url [String] The URL to make the GET request to
214
- # @param headers [Hash] Optional headers to include in the request (keys will
215
- # be converted to strings)
216
197
  # @yield [Tempfile] The temporary file containing the response body, after
217
198
  # decoration
218
- def get(url, headers: {}, &block)
199
+ def get(url, **opts, &block)
200
+ opts.delete(:response_block) and raise ArgumentError, 'response_block not allowed'
201
+ middlewares = (self.middlewares | Array((opts.delete(:middlewares)))).uniq
202
+ headers = opts.delete(:headers) || {}
219
203
  headers |= self.headers
220
204
  headers = headers.transform_keys(&:to_s)
221
205
  response = nil
222
206
  Tempfile.open do |tmp|
223
207
  infobar.label = 'Getting'
224
208
  if @streaming
225
- response = excon(url, headers:, response_block: callback(tmp)).request(method: :get)
209
+ response = excon(url, headers:, response_block: callback(tmp), **opts).request(method: :get)
226
210
  response.status != 200 || !@started and raise RetryWithoutStreaming
227
211
  decorate_io(tmp, response)
228
212
  infobar.finish
229
213
  block.(tmp)
230
214
  else
231
- response = excon(url, headers:, middlewares:).request(method: :get)
215
+ response = excon(url, headers:, middlewares:, **opts).request(method: :get)
232
216
  if response.status != 200
233
217
  raise "invalid response status code"
234
218
  end
@@ -251,6 +235,23 @@ class OllamaChat::Utils::Fetcher
251
235
  yield HeaderExtension.failed
252
236
  end
253
237
 
238
+ private
239
+
240
+ # The excon method creates a new Excon client instance configured with the
241
+ # specified URL and options.
242
+ #
243
+ # @param url [ String ] the URL to be used for the Excon client
244
+ # @param options [ Hash ] additional options to be merged with http_options
245
+ #
246
+ # @return [ Excon ] a new Excon client instance
247
+ #
248
+ # @see #normalize_url
249
+ # @see #http_options
250
+ def excon(url, **options)
251
+ url = self.class.normalize_url(url)
252
+ Excon.new(url, options.merge(@http_options))
253
+ end
254
+
254
255
  # The headers method returns a hash containing the default HTTP headers
255
256
  # that should be used for requests, including a User-Agent header
256
257
  # configured with the application's user agent string.
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.63'
3
+ VERSION = '0.0.65'
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_chat.rb CHANGED
@@ -25,6 +25,13 @@ module OllamaChat
25
25
  class InvalidPathError < OllamaChatError
26
26
  attr_accessor :path
27
27
  end
28
+
29
+ # Error raised when a path is outside the allowed whitelist.
30
+ #
31
+ # The error carries the offending `#path` as an attribute so that callers can
32
+ # log or display the problematic location.
33
+ class ConfigMissingError < OllamaChatError
34
+ end
28
35
  end
29
36
 
30
37
  require 'ollama'
data/ollama_chat.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama_chat 0.0.63 ruby lib
2
+ # stub: ollama_chat 0.0.65 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.63".freeze
6
+ s.version = "0.0.65".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]
@@ -12,15 +12,15 @@ Gem::Specification.new do |s|
12
12
  s.description = "The app provides a command-line interface (CLI) to an Ollama AI model,\nallowing users to engage in text-based conversations and generate\nhuman-like responses. Users can import data from local files or web pages,\nwhich are then processed through three different modes: fully importing the\ncontent into the conversation context, summarizing the information for\nconcise reference, or storing it in an embedding vector database for later\nretrieval based on the conversation.\n".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ollama_chat".freeze, "ollama_chat_send".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/vim_open_file.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
- s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/vim_open_file.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/deep/deeper/empty.txt".freeze, "spec/assets/deep/deeper/not-empty.txt".freeze, "spec/assets/deep/empty.txt".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/vim_open_file_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/vim_open_file.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze]
16
+ s.files = [".utilsrc".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ollama_chat".freeze, "bin/ollama_chat_send".freeze, "config/searxng/settings.yml".freeze, "docker-compose.yml".freeze, "lib/ollama_chat.rb".freeze, "lib/ollama_chat/chat.rb".freeze, "lib/ollama_chat/clipboard.rb".freeze, "lib/ollama_chat/conversation.rb".freeze, "lib/ollama_chat/dialog.rb".freeze, "lib/ollama_chat/document_cache.rb".freeze, "lib/ollama_chat/env_config.rb".freeze, "lib/ollama_chat/follow_chat.rb".freeze, "lib/ollama_chat/history.rb".freeze, "lib/ollama_chat/information.rb".freeze, "lib/ollama_chat/input_content.rb".freeze, "lib/ollama_chat/kramdown_ansi.rb".freeze, "lib/ollama_chat/location_handling.rb".freeze, "lib/ollama_chat/message_editing.rb".freeze, "lib/ollama_chat/message_format.rb".freeze, "lib/ollama_chat/message_list.rb".freeze, "lib/ollama_chat/message_output.rb".freeze, "lib/ollama_chat/model_handling.rb".freeze, "lib/ollama_chat/ollama_chat_config.rb".freeze, "lib/ollama_chat/ollama_chat_config/default_config.yml".freeze, "lib/ollama_chat/parsing.rb".freeze, "lib/ollama_chat/redis_cache.rb".freeze, "lib/ollama_chat/server_socket.rb".freeze, "lib/ollama_chat/source_fetching.rb".freeze, "lib/ollama_chat/state_selectors.rb".freeze, "lib/ollama_chat/switches.rb".freeze, "lib/ollama_chat/think_control.rb".freeze, "lib/ollama_chat/tool_calling.rb".freeze, "lib/ollama_chat/tools.rb".freeze, "lib/ollama_chat/tools/browse.rb".freeze, "lib/ollama_chat/tools/concern.rb".freeze, "lib/ollama_chat/tools/directory_structure.rb".freeze, "lib/ollama_chat/tools/endoflife.rb".freeze, "lib/ollama_chat/tools/execute_grep.rb".freeze, "lib/ollama_chat/tools/file_context.rb".freeze, "lib/ollama_chat/tools/gem_path_lookup.rb".freeze, "lib/ollama_chat/tools/get_current_weather.rb".freeze, "lib/ollama_chat/tools/get_cve.rb".freeze, "lib/ollama_chat/tools/get_endoflife.rb".freeze, "lib/ollama_chat/tools/get_jira_issue.rb".freeze, "lib/ollama_chat/tools/get_location.rb".freeze, "lib/ollama_chat/tools/get_time.rb".freeze, "lib/ollama_chat/tools/import_url.rb".freeze, "lib/ollama_chat/tools/read_file.rb".freeze, "lib/ollama_chat/tools/run_tests.rb".freeze, "lib/ollama_chat/tools/search_web.rb".freeze, "lib/ollama_chat/tools/vim_open_file.rb".freeze, "lib/ollama_chat/tools/weather/dwd_sensor.rb".freeze, "lib/ollama_chat/tools/write_file.rb".freeze, "lib/ollama_chat/utils.rb".freeze, "lib/ollama_chat/utils/analyze_directory.rb".freeze, "lib/ollama_chat/utils/cache_fetcher.rb".freeze, "lib/ollama_chat/utils/chooser.rb".freeze, "lib/ollama_chat/utils/fetcher.rb".freeze, "lib/ollama_chat/utils/file_argument.rb".freeze, "lib/ollama_chat/utils/path_validator.rb".freeze, "lib/ollama_chat/version.rb".freeze, "lib/ollama_chat/vim.rb".freeze, "lib/ollama_chat/web_searching.rb".freeze, "ollama_chat.gemspec".freeze, "redis/redis.conf".freeze, "spec/assets/api_show.json".freeze, "spec/assets/api_tags.json".freeze, "spec/assets/api_version.json".freeze, "spec/assets/conversation.json".freeze, "spec/assets/deep/deeper/empty.txt".freeze, "spec/assets/deep/deeper/not-empty.txt".freeze, "spec/assets/deep/empty.txt".freeze, "spec/assets/duckduckgo.html".freeze, "spec/assets/example.atom".freeze, "spec/assets/example.csv".freeze, "spec/assets/example.html".freeze, "spec/assets/example.pdf".freeze, "spec/assets/example.ps".freeze, "spec/assets/example.rb".freeze, "spec/assets/example.rss".freeze, "spec/assets/example.xml".freeze, "spec/assets/example_with_quote.html".freeze, "spec/assets/kitten.jpg".freeze, "spec/assets/prompt.txt".freeze, "spec/assets/searxng.json".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/vim_open_file_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tmp/.keep".freeze]
17
17
  s.homepage = "https://github.com/flori/ollama_chat".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "OllamaChat - A command-line interface (CLI) for interacting with an Ollama AI model.".freeze, "--main".freeze, "README.md".freeze]
20
20
  s.required_ruby_version = Gem::Requirement.new(">= 3.2".freeze)
21
21
  s.rubygems_version = "4.0.3".freeze
22
22
  s.summary = "A command-line interface (CLI) for interacting with an Ollama AI model.".freeze
23
- s.test_files = ["spec/assets/example.rb".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/vim_open_file_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
+ s.test_files = ["spec/assets/example.rb".freeze, "spec/ollama_chat/chat_spec.rb".freeze, "spec/ollama_chat/clipboard_spec.rb".freeze, "spec/ollama_chat/follow_chat_spec.rb".freeze, "spec/ollama_chat/information_spec.rb".freeze, "spec/ollama_chat/input_content_spec.rb".freeze, "spec/ollama_chat/kramdown_ansi_spec.rb".freeze, "spec/ollama_chat/message_editing_spec.rb".freeze, "spec/ollama_chat/message_list_spec.rb".freeze, "spec/ollama_chat/message_output_spec.rb".freeze, "spec/ollama_chat/model_handling_spec.rb".freeze, "spec/ollama_chat/parsing_spec.rb".freeze, "spec/ollama_chat/redis_cache_spec.rb".freeze, "spec/ollama_chat/server_socket_spec.rb".freeze, "spec/ollama_chat/source_fetching_spec.rb".freeze, "spec/ollama_chat/state_selectors_spec.rb".freeze, "spec/ollama_chat/switches_spec.rb".freeze, "spec/ollama_chat/think_control_spec.rb".freeze, "spec/ollama_chat/tools/browse_spec.rb".freeze, "spec/ollama_chat/tools/directory_structure_spec.rb".freeze, "spec/ollama_chat/tools/execute_grep_spec.rb".freeze, "spec/ollama_chat/tools/file_context_spec.rb".freeze, "spec/ollama_chat/tools/gem_path_lookup_spec.rb".freeze, "spec/ollama_chat/tools/get_current_weather_spec.rb".freeze, "spec/ollama_chat/tools/get_cve_spec.rb".freeze, "spec/ollama_chat/tools/get_endoflife_spec.rb".freeze, "spec/ollama_chat/tools/get_jira_issue_spec.rb".freeze, "spec/ollama_chat/tools/get_location_spec.rb".freeze, "spec/ollama_chat/tools/get_time_spec.rb".freeze, "spec/ollama_chat/tools/import_url_spec.rb".freeze, "spec/ollama_chat/tools/read_file_spec.rb".freeze, "spec/ollama_chat/tools/run_tests_spec.rb".freeze, "spec/ollama_chat/tools/search_web_spec.rb".freeze, "spec/ollama_chat/tools/vim_open_file_spec.rb".freeze, "spec/ollama_chat/tools/write_file_spec.rb".freeze, "spec/ollama_chat/utils/analyze_directory_spec.rb".freeze, "spec/ollama_chat/utils/cache_fetcher_spec.rb".freeze, "spec/ollama_chat/utils/fetcher_spec.rb".freeze, "spec/ollama_chat/utils/file_argument_spec.rb".freeze, "spec/ollama_chat/vim_spec.rb".freeze, "spec/ollama_chat/web_searching_spec.rb".freeze, "spec/spec_helper.rb".freeze]
24
24
 
25
25
  s.specification_version = 4
26
26
 
@@ -11,7 +11,7 @@ describe OllamaChat::MessageList do
11
11
  ),
12
12
  prompts: double(
13
13
  location: 'You are at %{location_name} (%{location_decimal_degrees}),' \
14
- ' on %{localtime}, preferring %{units}'
14
+ ' preferring %{units}'
15
15
  ),
16
16
  system_prompts: double(
17
17
  assistant?: 'You are a helpful assistant.'
@@ -257,7 +257,7 @@ describe OllamaChat::MessageList do
257
257
  it 'can determine location for system prompt' do
258
258
  expect(chat).to receive(:location).and_return(double(on?: true))
259
259
  expect(list.send(:at_location)).to match(
260
- %r(You are at Berlin \(52.514127, 13.475211\), on))
260
+ %r(You are at Berlin \(52.514127, 13.475211\), ))
261
261
  end
262
262
 
263
263
  it 'can be converted int an Ollama::Message array' do
@@ -275,7 +275,7 @@ describe OllamaChat::MessageList do
275
275
  first = list.to_ary.first
276
276
  expect(first.role).to eq 'system'
277
277
  expect(first.content).to match(
278
- %r(You are at Berlin \(52.514127, 13.475211\), on))
278
+ %r(You are at Berlin \(52.514127, 13.475211\), ))
279
279
  end
280
280
 
281
281
  it 'can be converted int an Ollama::Message array with location without a system prompt' do
@@ -287,7 +287,7 @@ describe OllamaChat::MessageList do
287
287
  first = list.to_ary.first
288
288
  expect(first.role).to eq 'system'
289
289
  expect(first.content).to match(
290
- %r(You are a helpful assistant.\n\nYou are at Berlin \(52.514127, 13.475211\), on))
290
+ %r(You are a helpful assistant.\n\nYou are at Berlin \(52.514127, 13.475211\), ))
291
291
  end
292
292
 
293
293
 
@@ -54,7 +54,7 @@ describe OllamaChat::Tools::DirectoryStructure do
54
54
  # Should return valid JSON
55
55
  expect(result).to be_a(String)
56
56
  json = json_object(result)
57
- expect(json.size).to be > 18
57
+ expect(json.size).to be_an Integer
58
58
  end
59
59
 
60
60
  it 'can handle execution errors gracefully' do
@@ -27,7 +27,7 @@ describe OllamaChat::Tools::GetCVE do
27
27
  function: double(
28
28
  name: 'get_cve',
29
29
  arguments: double(
30
- cve_id: cve_id
30
+ cve_id:
31
31
  )
32
32
  )
33
33
  )
@@ -35,7 +35,7 @@ describe OllamaChat::Tools::GetCVE do
35
35
  url = chat.config.tools.get_cve.url
36
36
 
37
37
  # Stub the HTTP request
38
- stub_request(:get, url % { cve_id: cve_id })
38
+ stub_request(:get, url % { cve_id: })
39
39
  .to_return(
40
40
  status: 200,
41
41
  body: '{"id": "CVE-2023-12345", "description": "Test vulnerability description"}',
@@ -55,7 +55,7 @@ describe OllamaChat::Tools::GetCVE do
55
55
  function: double(
56
56
  name: 'get_cve',
57
57
  arguments: double(
58
- cve_id: cve_id
58
+ cve_id:
59
59
  )
60
60
  )
61
61
  )
@@ -0,0 +1,100 @@
1
+ require 'spec_helper'
2
+
3
+ describe OllamaChat::Tools::GetJiraIssue do
4
+ let :chat do
5
+ OllamaChat::Chat.new argv: chat_default_config
6
+ end
7
+
8
+ connect_to_ollama_server
9
+
10
+ it 'can have name' do
11
+ expect(described_class.new.name).to eq 'get_jira_issue'
12
+ end
13
+
14
+ it 'can have tool' do
15
+ expect(described_class.new.tool).to be_a Ollama::Tool
16
+ end
17
+
18
+ it 'can be converted to hash' do
19
+ expect(described_class.new.to_hash).to be_a Hash
20
+ end
21
+
22
+ context 'when configured via env var' do
23
+ before do
24
+ const_conf_as(
25
+ 'OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA::URL' => 'https://foobar.atlassian.net',
26
+ 'OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA::USER' => 'theuser',
27
+ 'OllamaChat::EnvConfig::OLLAMA::CHAT::TOOLS::JIRA::API_TOKEN' => 'secret',
28
+ )
29
+ end
30
+
31
+ it 'can be executed successfully' do
32
+ issue_key = 'FOO-1234'
33
+ tool_call = double(
34
+ 'ToolCall',
35
+ function: double(
36
+ name: 'get_jira_issue',
37
+ arguments: double(
38
+ issue_key:
39
+ )
40
+ )
41
+ )
42
+
43
+ stub_request(:get, "https://foobar.atlassian.net/rest/api/3/issue/FOO-1234")
44
+ .to_return(
45
+ status: 200,
46
+ body: "{\"issue_key\": \"FOO-1234\", \"description\": \"some description\"}",
47
+ headers: {}
48
+ )
49
+
50
+ result = described_class.new.execute(tool_call, config: chat.config)
51
+
52
+ json = json_object(result)
53
+ expect(json.issue_key).to eq 'FOO-1234'
54
+ expect(json.description).to eq 'some description'
55
+ end
56
+
57
+ it 'can handle execution errors gracefully' do
58
+ issue_key = 'FOO-1234'
59
+ tool_call = double(
60
+ 'ToolCall',
61
+ function: double(
62
+ name: 'get_jira_issue',
63
+ arguments: double(
64
+ issue_key:
65
+ )
66
+ )
67
+ )
68
+
69
+ stub_request(:get, "https://foobar.atlassian.net/rest/api/3/issue/FOO-1234")
70
+ .to_return(status: 404, body: 'Not Found')
71
+
72
+ result = described_class.new.execute(tool_call, config: chat.config)
73
+ json = json_object(result)
74
+ expect(json.error).to eq 'JSON::ParserError'
75
+ expect(json.message).to eq 'require JSON data'
76
+ end
77
+ end
78
+
79
+ context 'when not configured via env var' do
80
+ it 'can handle execution errors gracefully' do
81
+ issue_key = 'FOO-1234'
82
+ tool_call = double(
83
+ 'ToolCall',
84
+ function: double(
85
+ name: 'get_jira_issue',
86
+ arguments: double(
87
+ issue_key:
88
+ )
89
+ )
90
+ )
91
+
92
+ stub_request(:get, "https://foobar.atlassian.net/rest/api/3/issue/FOO-1234")
93
+ .to_return(status: 404, body: 'Not Found')
94
+
95
+ result = described_class.new.execute(tool_call, config: chat.config)
96
+ json = json_object(result)
97
+ expect(json.error).to eq 'OllamaChat::ConfigMissingError'
98
+ end
99
+ end
100
+ end
@@ -24,11 +24,10 @@ describe OllamaChat::Tools::GetLocation do
24
24
  location_data = {
25
25
  latitude: 40.7128,
26
26
  longitude: -74.0060,
27
- time: '2023-05-15T14:30:00Z',
28
27
  units: 'metric'
29
28
  }
30
29
 
31
- chat_instance = double('Chat', location_data: location_data)
30
+ expect(chat).to receive(:location_data).and_return location_data
32
31
 
33
32
  tool_call = double(
34
33
  'ToolCall',
@@ -38,20 +37,15 @@ describe OllamaChat::Tools::GetLocation do
38
37
  )
39
38
  )
40
39
 
41
- result = described_class.new.execute(tool_call, chat: chat_instance)
40
+ result = described_class.new.execute(tool_call, chat:)
42
41
 
43
- # Parse the JSON result to verify content
44
- parsed_result = JSON.parse(result)
45
- expect(parsed_result['latitude']).to be_within(0.0001).of(40.7128)
46
- expect(parsed_result['longitude']).to be_within(0.0001).of(-74.0060)
47
- expect(parsed_result['time']).to eq '2023-05-15T14:30:00Z'
48
- expect(parsed_result['units']).to eq 'metric'
42
+ json = json_object(result)
43
+ expect(json.latitude).to be_within(0.0001).of(40.7128)
44
+ expect(json.longitude).to be_within(0.0001).of(-74.0060)
45
+ expect(json.units).to eq 'metric'
49
46
  end
50
47
 
51
48
  it 'can handle execution errors gracefully' do
52
- # Mock a chat instance that raises an error when accessing location_data
53
- chat_instance = double('Chat', location_data: nil)
54
-
55
49
  tool_call = double(
56
50
  'ToolCall',
57
51
  function: double(
@@ -62,14 +56,12 @@ describe OllamaChat::Tools::GetLocation do
62
56
 
63
57
  # Test that the method handles nil location_data gracefully
64
58
  expect {
65
- described_class.new.execute(tool_call, chat: chat_instance)
59
+ described_class.new.execute(tool_call, chat:)
66
60
  }.to_not raise_error
67
61
  end
68
62
 
69
63
  context 'when location_data is not available' do
70
64
  it 'returns valid JSON even with missing data' do
71
- chat_instance = double('Chat', location_data: nil)
72
-
73
65
  tool_call = double(
74
66
  'ToolCall',
75
67
  function: double(
@@ -78,7 +70,7 @@ describe OllamaChat::Tools::GetLocation do
78
70
  )
79
71
  )
80
72
 
81
- result = described_class.new.execute(tool_call, chat: chat_instance)
73
+ result = described_class.new.execute(tool_call, chat:)
82
74
  # Should still be valid JSON even if location_data is nil
83
75
  expect { JSON.parse(result) }.to_not raise_error
84
76
  end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe OllamaChat::Tools::GetTime do
4
+ let :chat do
5
+ OllamaChat::Chat.new(argv: chat_default_config)
6
+ end
7
+
8
+ connect_to_ollama_server
9
+
10
+ it 'can have name' do
11
+ expect(described_class.new.name).to eq 'get_time'
12
+ end
13
+
14
+ it 'can have tool' do
15
+ expect(described_class.new.tool).to be_a Ollama::Tool
16
+ end
17
+
18
+ it 'can be converted to hash' do
19
+ expect(described_class.new.to_hash).to be_a Hash
20
+ end
21
+
22
+ it 'can be executed successfully' do
23
+ tool_call = double(
24
+ 'ToolCall',
25
+ function: double(
26
+ name: 'get_time',
27
+ arguments: double()
28
+ )
29
+ )
30
+
31
+ result = described_class.new.execute(tool_call, chat:)
32
+
33
+ json = json_object(result)
34
+
35
+ expect(json.time).to match(
36
+ /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}\z/
37
+ )
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.63
4
+ version: 0.0.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -488,7 +488,9 @@ extra_rdoc_files:
488
488
  - lib/ollama_chat/tools/get_current_weather.rb
489
489
  - lib/ollama_chat/tools/get_cve.rb
490
490
  - lib/ollama_chat/tools/get_endoflife.rb
491
+ - lib/ollama_chat/tools/get_jira_issue.rb
491
492
  - lib/ollama_chat/tools/get_location.rb
493
+ - lib/ollama_chat/tools/get_time.rb
492
494
  - lib/ollama_chat/tools/import_url.rb
493
495
  - lib/ollama_chat/tools/read_file.rb
494
496
  - lib/ollama_chat/tools/run_tests.rb
@@ -555,7 +557,9 @@ files:
555
557
  - lib/ollama_chat/tools/get_current_weather.rb
556
558
  - lib/ollama_chat/tools/get_cve.rb
557
559
  - lib/ollama_chat/tools/get_endoflife.rb
560
+ - lib/ollama_chat/tools/get_jira_issue.rb
558
561
  - lib/ollama_chat/tools/get_location.rb
562
+ - lib/ollama_chat/tools/get_time.rb
559
563
  - lib/ollama_chat/tools/import_url.rb
560
564
  - lib/ollama_chat/tools/read_file.rb
561
565
  - lib/ollama_chat/tools/run_tests.rb
@@ -620,7 +624,9 @@ files:
620
624
  - spec/ollama_chat/tools/get_current_weather_spec.rb
621
625
  - spec/ollama_chat/tools/get_cve_spec.rb
622
626
  - spec/ollama_chat/tools/get_endoflife_spec.rb
627
+ - spec/ollama_chat/tools/get_jira_issue_spec.rb
623
628
  - spec/ollama_chat/tools/get_location_spec.rb
629
+ - spec/ollama_chat/tools/get_time_spec.rb
624
630
  - spec/ollama_chat/tools/import_url_spec.rb
625
631
  - spec/ollama_chat/tools/read_file_spec.rb
626
632
  - spec/ollama_chat/tools/run_tests_spec.rb
@@ -687,7 +693,9 @@ test_files:
687
693
  - spec/ollama_chat/tools/get_current_weather_spec.rb
688
694
  - spec/ollama_chat/tools/get_cve_spec.rb
689
695
  - spec/ollama_chat/tools/get_endoflife_spec.rb
696
+ - spec/ollama_chat/tools/get_jira_issue_spec.rb
690
697
  - spec/ollama_chat/tools/get_location_spec.rb
698
+ - spec/ollama_chat/tools/get_time_spec.rb
691
699
  - spec/ollama_chat/tools/import_url_spec.rb
692
700
  - spec/ollama_chat/tools/read_file_spec.rb
693
701
  - spec/ollama_chat/tools/run_tests_spec.rb