ollama_chat 0.0.63 → 0.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +15 -0
- data/lib/ollama_chat/env_config.rb +22 -0
- data/lib/ollama_chat/ollama_chat_config/default_config.yml +2 -0
- data/lib/ollama_chat/tools/get_jira_issue.rb +74 -0
- data/lib/ollama_chat/tools.rb +1 -0
- data/lib/ollama_chat/utils/fetcher.rb +23 -22
- data/lib/ollama_chat/version.rb +1 -1
- data/lib/ollama_chat.rb +7 -0
- data/ollama_chat.gemspec +5 -5
- data/spec/ollama_chat/tools/directory_structure_spec.rb +1 -1
- data/spec/ollama_chat/tools/get_cve_spec.rb +3 -3
- data/spec/ollama_chat/tools/get_jira_issue_spec.rb +100 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcb955cd7607555be0e5cf86a3cc9f1ee346a0e7e316dc2cb747ec5891ab2aa3
|
|
4
|
+
data.tar.gz: c012ef755865d3070e171438bc297ac8867ad9c229c8bb2cb64d8443edee5f14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d6c66f01bf73150d6c5933193d23069df1993dfa70238262ccdedf72aa37841368185d00139cb2f10f7949e1a6eeeb2ff1453e68002dd40cb0ff3395c5cc497
|
|
7
|
+
data.tar.gz: 8651e4210a799e4bf95ddffb80dfced2c4ae90e49426c9ab34b9743393b11476dc113b057be1d03266129605dfdb51af550bacc67d955638b3d35d0de89597e6
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-02-09 v0.0.64
|
|
4
|
+
|
|
5
|
+
- Added new `OllamaChat::Tools::GetJiraIssue` tool for fetching JIRA issue
|
|
6
|
+
information
|
|
7
|
+
- Introduced `ConfigMissingError` exception for handling missing configuration
|
|
8
|
+
- Added JIRA tool configuration in `OllamaChat::EnvConfig` with `URL`, `USER`,
|
|
9
|
+
and `API_TOKEN` settings
|
|
10
|
+
- Updated `default_config.yml` to include `get_jira_issue` tool with `default:
|
|
11
|
+
false`
|
|
12
|
+
- Enhanced `OllamaChat::Utils::Fetcher` to support additional options and
|
|
13
|
+
middleware
|
|
14
|
+
- Added comprehensive tests for the new `get_jira_issue` tool in
|
|
15
|
+
`spec/ollama_chat/tools/get_jira_issue_spec.rb`
|
|
16
|
+
- Updated tool registration to include the new `get_jira_issue` tool
|
|
17
|
+
|
|
3
18
|
## 2026-02-09 v0.0.63
|
|
4
19
|
|
|
5
20
|
- 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
|
|
@@ -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
|
data/lib/ollama_chat/tools.rb
CHANGED
|
@@ -50,6 +50,7 @@ require 'ollama_chat/tools/get_cve'
|
|
|
50
50
|
require 'ollama_chat/tools/get_endoflife'
|
|
51
51
|
require 'ollama_chat/tools/get_location'
|
|
52
52
|
require 'ollama_chat/tools/import_url'
|
|
53
|
+
require 'ollama_chat/tools/get_jira_issue'
|
|
53
54
|
require 'ollama_chat/tools/read_file'
|
|
54
55
|
require 'ollama_chat/tools/run_tests'
|
|
55
56
|
require 'ollama_chat/tools/search_web'
|
|
@@ -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,
|
|
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
|
|
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.
|
data/lib/ollama_chat/version.rb
CHANGED
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.
|
|
2
|
+
# stub: ollama_chat 0.0.64 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "ollama_chat".freeze
|
|
6
|
-
s.version = "0.0.
|
|
6
|
+
s.version = "0.0.64".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/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/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/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/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
|
|
|
@@ -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
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
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.
|
|
4
|
+
version: 0.0.64
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -488,6 +488,7 @@ 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
|
|
492
493
|
- lib/ollama_chat/tools/import_url.rb
|
|
493
494
|
- lib/ollama_chat/tools/read_file.rb
|
|
@@ -555,6 +556,7 @@ files:
|
|
|
555
556
|
- lib/ollama_chat/tools/get_current_weather.rb
|
|
556
557
|
- lib/ollama_chat/tools/get_cve.rb
|
|
557
558
|
- lib/ollama_chat/tools/get_endoflife.rb
|
|
559
|
+
- lib/ollama_chat/tools/get_jira_issue.rb
|
|
558
560
|
- lib/ollama_chat/tools/get_location.rb
|
|
559
561
|
- lib/ollama_chat/tools/import_url.rb
|
|
560
562
|
- lib/ollama_chat/tools/read_file.rb
|
|
@@ -620,6 +622,7 @@ files:
|
|
|
620
622
|
- spec/ollama_chat/tools/get_current_weather_spec.rb
|
|
621
623
|
- spec/ollama_chat/tools/get_cve_spec.rb
|
|
622
624
|
- spec/ollama_chat/tools/get_endoflife_spec.rb
|
|
625
|
+
- spec/ollama_chat/tools/get_jira_issue_spec.rb
|
|
623
626
|
- spec/ollama_chat/tools/get_location_spec.rb
|
|
624
627
|
- spec/ollama_chat/tools/import_url_spec.rb
|
|
625
628
|
- spec/ollama_chat/tools/read_file_spec.rb
|
|
@@ -687,6 +690,7 @@ test_files:
|
|
|
687
690
|
- spec/ollama_chat/tools/get_current_weather_spec.rb
|
|
688
691
|
- spec/ollama_chat/tools/get_cve_spec.rb
|
|
689
692
|
- spec/ollama_chat/tools/get_endoflife_spec.rb
|
|
693
|
+
- spec/ollama_chat/tools/get_jira_issue_spec.rb
|
|
690
694
|
- spec/ollama_chat/tools/get_location_spec.rb
|
|
691
695
|
- spec/ollama_chat/tools/import_url_spec.rb
|
|
692
696
|
- spec/ollama_chat/tools/read_file_spec.rb
|