ollama-ruby 0.7.0 → 0.9.0

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: 5bdf85f296b631c52b44984eee6a5e6d98c82a4cfc4a5764529f4d46b3bdaba7
4
- data.tar.gz: 05e391e492f85f8c6fb1106d49ff4118c26a0922c5978156e2f1364aad82299d
3
+ metadata.gz: d0b3ea2bd67e3f4fa2ca4da88a25cb869fc81e35578f1e7fd97ba43e84fc2278
4
+ data.tar.gz: 626c534bd2fd0580ab0520e8b70587489edbc963e179be0f800ee63235690b33
5
5
  SHA512:
6
- metadata.gz: 7a3f77296a526154ed46860a675515b864baa8c991933e76ceeb178b00037df844f20201ad200cb9df8d4fa105066fb40bb0248db3bb65c5bad81012ce3b7288
7
- data.tar.gz: 1d25c9420fba86d992b77f29e4f4f57734dcbdaba864650f626af1c828262a9470f9c981da602335f8d3a03ef3cfc9773ad33d90d3e88a70a4d86be0518d762a
6
+ metadata.gz: 149986d8144b1bc2c20771e245ead20f6e6bc07b46dbe26f8f355e0bc61eca146cc085a920dcbe3e3e08de65632693a35b6995c9dffef288aa929dd6b034de16
7
+ data.tar.gz: 4214aa2911db561635011b8ea200074d15c74b93bf7abb3c8e77af9c40ac5d8994e908e2ade8e5f288c2919678e03ea5d84d07684a63ba1f8039de52b6091a86
data/CHANGES.md CHANGED
@@ -1,99 +1,142 @@
1
1
  # Changes
2
2
 
3
+ ## 2024-10-18 v0.9.0
4
+
5
+ * Add document policy chooser and modify embedding/importing/summarizing
6
+ behavior:
7
+ + Add `/document_policy` command to choose a scan policy for document
8
+ references
9
+ + Modify `embed_source`, `import_source`, and `summarize_source` methods to
10
+ use the chosen document policy
11
+ + Update `choose_model` method to set `$document_policy` based on
12
+ configuration or chat command
13
+ * Fix regular expression in `ollama_chat` script:
14
+ + Updated regular expression for `/info` to `/^/info$`
15
+ * Improve ask prompt to ask about clearing messages and collection.
16
+ * Update specs to use `expect` instead of `allow`
17
+ * Fix library homepage URL in README.md
18
+ * Refactor Markdown handler to remove unnecessary puts statement
19
+ * Reorder chapters in README.md a bit
20
+
21
+ ## 2024-10-07 v0.8.0
22
+
23
+ * **Refactor source handling in Ollama chat**:
24
+ + Update regular expression to match dot-dot, dot or tilde prefix for local files
25
+ + Add error handling for non-existent files in `Utils::Fetcher.read`
26
+ + Stop matching the "hostname" part in file:// URLs
27
+ * **Update voice list command to suppress errors**:
28
+ + Changed `say` command in OllamaChatConfig to `-v ? 2>/dev/null`
29
+ * **Add 'List:' and list of collections to the collection stats output**
30
+ * **Update collection stats display**:
31
+ + Added new stat: `#Tags` to `collection_stats` method in `ollama_chat.rb`
32
+ + Displaying number of tags for the current document collection
33
+ * **Refactor embed_source function to include document count**:
34
+ + Added `count` parameter to `embed_source` method
35
+ + Updated `puts` statements in `embed_source` and main loop to display document counts
36
+ + Incremented `count` variable in main loop to track total documents embedded
37
+ + Passed `count:` keyword argument to `embed_source` method
38
+ * **Add config option for batch_size and update document adding logic**:
39
+ + Added `batch_size` option to `OllamaChatConfig`
40
+ + Updated `embed_source` method in `bin/ollama_chat` to use `batch_size` from `config`
41
+ + Updated `add` method in `lib/ollama/documents.rb` to accept `batch_size` and default to 10
42
+ * **Update Redis image to valkey/valkey:7.2.7-alpine**:
43
+ + Updated `image` in `docker-compose.yml` to `valkey/valkey:7.2.7-alpine`
44
+ * **Reformat CHANGES.md**
45
+
3
46
  ## 2024-10-03 v0.7.0
4
47
 
5
48
  * **Refactor command line interface**
6
- + Moved case order
7
- + Renamed `/collection clear [tag]|change` to `/collection (clear|change)`
8
- + Improved help message, added /info
49
+ + Moved case order
50
+ + Renamed `/collection clear [tag]|change` to `/collection (clear|change)`
51
+ + Improved help message, added /info
9
52
  * **Update README.md**
10
- + Update README.md to reflect changed/added commands
53
+ + Update README.md to reflect changed/added commands
11
54
  * **Add support for reading PostScript**
12
- + Extracted `pdf_read` method to read PDF files using `PDF::Reader`
13
- + Added `ps_read` method to read PostScript files by converting them to PDF with Ghostscript and using `pdf_read`.
14
- + Updated `parse_source` method to handle PostScript files
55
+ + Extracted `pdf_read` method to read PDF files using `PDF::Reader`
56
+ + Added `ps_read` method to read PostScript files by converting them to PDF with Ghostscript and using `pdf_read`.
57
+ + Updated `parse_source` method to handle PostScript files
15
58
  * **Update read buffer size for tempfile writes**
16
- + Updated `tmp.write` to use a larger buffer size (**16KB**) in IO.popen block.
59
+ + Updated `tmp.write` to use a larger buffer size (**16KB**) in IO.popen block.
17
60
  * **Refactor Collection Chooser and usages**
18
- + Added confirmation prompt before clearing collection
19
- + Improved collection chooser with `[EXIT]` and `[ALL]` options
20
- + Added `ask?` method for user input
61
+ + Added confirmation prompt before clearing collection
62
+ + Improved collection chooser with `[EXIT]` and `[ALL]` options
63
+ + Added `ask?` method for user input
21
64
  * **Add prompt to choose method**
22
- + Added `prompt` parameter to `choose` method in `Ollama::Utils::Chooser`
23
- + Modified output formatting for selected entry in `choose` method
24
- + Updated `choose` method to handle cases better where no entry was chosen
65
+ + Added `prompt` parameter to `choose` method in `Ollama::Utils::Chooser`
66
+ + Modified output formatting for selected entry in `choose` method
67
+ + Updated `choose` method to handle cases better where no entry was chosen
25
68
  * **Fix Redis cache expiration logic**
26
- + Update `set` method to delete key expiration time is less than 1 second.
69
+ + Update `set` method to delete key expiration time is less than 1 second.
27
70
  * **Update dependencies and add source tracking**
28
- - Remove `sorted_set` dependency from Rakefile
29
- - Modify `Ollama::Documents` class to track source of tags
30
- - Update `Ollama::Utils::Tags` class to include source in tag output and add methods for tracking source
31
- - Update tests for `Ollama::Utils::Tags` class
71
+ - Remove `sorted_set` dependency from Rakefile
72
+ - Modify `Ollama::Documents` class to track source of tags
73
+ - Update `Ollama::Utils::Tags` class to include source in tag output and add methods for tracking source
74
+ - Update tests for `Ollama::Utils::Tags` class
32
75
  * **Refactor width calculation and add tests for wrap and truncate methods.**
33
- + Extend `Term::ANSIColor` in `Ollama::Utils::Width`
34
- + Update `width` method to use ellipsis length when truncating text
35
- + Add tests for `wrap` and `truncate` methods with percentage and length arguments
76
+ + Extend `Term::ANSIColor` in `Ollama::Utils::Width`
77
+ + Update `width` method to use ellipsis length when truncating text
78
+ + Add tests for `wrap` and `truncate` methods with percentage and length arguments
36
79
  * **Add attr_reader for data and update equality check**
37
- + Added `attr_reader :data` to Ollama::Image class
38
- + Updated `==` method in Ollama::Image class to use `other.data`
39
- + Added test case in `image_spec.rb` to verify equality of images
80
+ + Added `attr_reader :data` to Ollama::Image class
81
+ + Updated `==` method in Ollama::Image class to use `other.data`
82
+ + Added test case in `image_spec.rb` to verify equality of images
40
83
 
41
84
  ## 2024-09-30 v0.6.0
42
85
 
43
86
  ### Significant Changes
44
87
 
45
88
  * **Added voice toggle and change functionality**:
46
- + Removed `-v` command line switch
47
- + Added new Switch class for voice output
48
- + Added new method `change_voice` to toggle or change voice output
49
- + Updated `info` method to display current voice output if enabled
50
- + Updated `display_chat_help` method to include /voice command
89
+ + Removed `-v` command line switch
90
+ + Added new Switch class for voice output
91
+ + Added new method `change_voice` to toggle or change voice output
92
+ + Updated `info` method to display current voice output if enabled
93
+ + Updated `display_chat_help` method to include /voice command
51
94
  * **Added expiring cache support**:
52
- + Added `Ollama::Utils::CacheFetcher` class for caching HTTP responses
53
- + Modified `Ollama::Utils::Fetcher` to use the new cache class
54
- + Updated `ollama_chat` script to use the cache when fetching sources
55
- + Added specs for the new cache fetcher class
95
+ + Added `Ollama::Utils::CacheFetcher` class for caching HTTP responses
96
+ + Modified `Ollama::Utils::Fetcher` to use the new cache class
97
+ + Updated `ollama_chat` script to use the cache when fetching sources
98
+ + Added specs for the new cache fetcher class
56
99
  * **Added change system prompt feature**:
57
- + Added `/system` command to change system prompt
58
- + Implemented `set_system_prompt` and `change_system_prompt` methods in `bin/ollama_chat`
59
- + Updated help messages in `README.md`
100
+ + Added `/system` command to change system prompt
101
+ + Implemented `set_system_prompt` and `change_system_prompt` methods in `bin/ollama_chat`
102
+ + Updated help messages in `README.md`
60
103
 
61
104
  ### Other Changes
62
105
 
63
106
  * **Updated dependencies**:
64
- + Updated version of `xdg` gem to **7.0**
65
- + Added `xdg` dependency to Rakefile
107
+ + Updated version of `xdg` gem to **7.0**
108
+ + Added `xdg` dependency to Rakefile
66
109
  * **Refactored error handling**:
67
- + Warn message updated to include more context about the error
68
- + `warn` statement now mentions "while pulling model"
110
+ + Warn message updated to include more context about the error
111
+ + `warn` statement now mentions "while pulling model"
69
112
  * **Updated chat commands and added clipboard functionality**:
70
- + Added `/copy` command to copy last response to clipboard
71
- + Implemented `copy_to_clipboard` method in `ollama_chat`
72
- + Updated chat help display to include new `/copy` command
113
+ + Added `/copy` command to copy last response to clipboard
114
+ + Implemented `copy_to_clipboard` method in `ollama_chat`
115
+ + Updated chat help display to include new `/copy` command
73
116
  * **Refactored Ollama::Utils::Fetcher**:
74
- + Made instance methods private and only exposed class methods
75
- + Added `expose` method to `Ollama::Utils::FetcherSpec` for testing
117
+ + Made instance methods private and only exposed class methods
118
+ + Added `expose` method to `Ollama::Utils::FetcherSpec` for testing
76
119
  * **Added version command to ollama chat binary**:
77
- + Added `version` method to print Ollama version and exit
78
- + Updated `$opts` string in `ollama` script to include `-V` option for version command
79
- + Added call to `version` method when `-V` option is used
120
+ + Added `version` method to print Ollama version and exit
121
+ + Updated `$opts` string in `ollama` script to include `-V` option for version command
122
+ + Added call to `version` method when `-V` option is used
80
123
  * **Updated system prompt display**:
81
- + Changed `Ollama::Utils::Width.wrap` to `Ollama::Utils::ANSIMarkdown.parse` in `show_system_prompt` method
124
+ + Changed `Ollama::Utils::Width.wrap` to `Ollama::Utils::ANSIMarkdown.parse` in `show_system_prompt` method
82
125
  * **Added system prompt configuration via search_ui for ? argument value**:
83
- + Added `show_system_prompt` method to print configured system prompt
84
- + Modified `info` method to include system prompt in output
85
- + Implemented option `-s ?` to choose or specify system prompt
126
+ + Added `show_system_prompt` method to print configured system prompt
127
+ + Modified `info` method to include system prompt in output
128
+ + Implemented option `-s ?` to choose or specify system prompt
86
129
 
87
130
  ## 2024-09-26 v0.5.0
88
131
 
89
132
  ### New Features
90
133
 
91
134
  * Add stdin substitution and variable expansion to `ollama_cli`:
92
- + Added support for `%{stdin}` in prompts, substituting with actual input
93
- + Added `-P` option to set prompt variables from command line arguments
94
- + Added handling of multiple placeholders in prompts
135
+ + Added support for `%{stdin}` in prompts, substituting with actual input
136
+ + Added `-P` option to set prompt variables from command line arguments
137
+ + Added handling of multiple placeholders in prompts
95
138
  * Add proxy support to Ollama chat client:
96
- + Add `tins/xt/hash_union` gem to dependencies
139
+ + Add `tins/xt/hash_union` gem to dependencies
97
140
  + Update `OllamaChatConfig` with new `proxy` option
98
141
  + Modify `http_options` method to include proxy and SSL verify peer options
99
142
  based on config settings
@@ -125,7 +168,7 @@
125
168
  + Added support for displaying a specific number of messages with `/list
126
169
  [n]`
127
170
  * Update chat commands' quit functionality:
128
- + Moved `/quit` command to exit the program
171
+ + Moved `/quit` command to exit the program
129
172
  * Refactor OllamaChatConfig web prompt:
130
173
  + Add `web` prompt to `OllamaChatConfig` class
131
174
  + Replace hardcoded content with variable `content`
@@ -155,10 +198,10 @@
155
198
  ### Refactoring
156
199
 
157
200
  * Refactor `file_argument.rb` for better readability:
158
- + Update conditionals in Ollama::Utils::FileArgument module
159
- + Simplify logic with improved variable usage
160
- + Remove unnecessary elsif statement
161
- + Use consistent indentation and spacing throughout the code
201
+ + Update conditionals in Ollama::Utils::FileArgument module
202
+ + Simplify logic with improved variable usage
203
+ + Remove unnecessary elsif statement
204
+ + Use consistent indentation and spacing throughout the code
162
205
  * Refactor Redis-backed memory cache:
163
206
  + Removed `pre` and `unpre` methods from `Ollama::Documents` use mixin
164
207
  instead.
@@ -166,12 +209,12 @@
166
209
  ### Documentation
167
210
 
168
211
  * Update README.md to reflect changes in `ollama_chat` functionality.
169
- + Modified commands:
170
- - `/import source` to import the source's content
171
- - `/embed source` to embed the source's content
212
+ + Modified commands:
213
+ - `/import source` to import the source's content
214
+ - `/embed source` to embed the source's content
172
215
  - `/summarize [n] source` to summarize the source's content in n words
173
216
  - `/embedding` to toggle embedding paused or not
174
- - `/embed source` to embed the source's content
217
+ - `/embed source` to embed the source's content
175
218
 
176
219
  ### Dependencies and Date Updates
177
220
 
@@ -179,13 +222,13 @@
179
222
  + Added `logger` (~> **1.0**) and `json` (~> **2.0**) as runtime
180
223
  dependencies to Rakefile and ollama-ruby.gemspec.
181
224
  + Updated date in ollama-ruby.gemspec from "2024-09-21" to "2024-09-22".
182
- + Added `require 'logger'` to lib/ollama.rb.
225
+ + Added `require 'logger'` to lib/ollama.rb.
183
226
 
184
227
  ### Other Changes
185
228
 
186
229
  * Add SSL no verify option to OllamaChatConfig and Utils::Fetcher:
187
- + Added `ssl_no_verify` option to OllamaChatConfig
188
- + Updated Utils::Fetcher to take an
230
+ + Added `ssl_no_verify` option to OllamaChatConfig
231
+ + Updated Utils::Fetcher to take an
189
232
 
190
233
  ## 2024-09-21 v0.4.0
191
234
 
@@ -218,20 +261,20 @@
218
261
  ## 2024-09-15 v0.3.2
219
262
 
220
263
  * Add color support to chooser module:
221
- + Include `Term::ANSIColor` in `Ollama::Utils::Chooser` module
264
+ + Include `Term::ANSIColor` in `Ollama::Utils::Chooser` module
222
265
  + Use `blue`, `on_blue` ANSI color for selected item in query method
223
266
  * Refactor summarize method to also import sources:
224
- + Added `content` variable to store result of `parse_source`
225
- + Replaced `or return` with explicit assignment and return
226
- + Added calls to `source_io.rewind` and `import_document`
267
+ + Added `content` variable to store result of `parse_source`
268
+ + Replaced `or return` with explicit assignment and return
269
+ + Added calls to `source_io.rewind` and `import_document`
227
270
  * Add new test for `file_argument_spec.rb`
228
271
  * Refactor tag list initialization and merging:
229
- + Use array literals for initializing tags lists
230
- + Use array literals for passing to merge method
272
+ + Use array literals for initializing tags lists
273
+ + Use array literals for passing to merge method
231
274
  * Update dependencies and dates in Rakefile and gemspec:
232
- + Removed '.utilsrc' from ignored files in Rakefile
233
- + Updated date in `ollama-ruby.gemspec` to "2024-09-13"
234
- + Removed 'utils' development dependency from `ollama-ruby.gemspec`
275
+ + Removed '.utilsrc' from ignored files in Rakefile
276
+ + Updated date in `ollama-ruby.gemspec` to "2024-09-13"
277
+ + Removed 'utils' development dependency from `ollama-ruby.gemspec`
235
278
  * Refactor `search_web` method to allow n parameter to be optional and default
236
279
  to 1.
237
280
 
@@ -306,31 +349,31 @@
306
349
  ### Changes
307
350
 
308
351
  * **Added Web Search Functionality to `ollama_chat`**
309
- + Added `/web` command to fetch search results from DuckDuckGo
310
- + Updated `/summarize` command to handle cases where summarization fails
311
- + Fix bug in parsing content type of source document
352
+ + Added `/web` command to fetch search results from DuckDuckGo
353
+ + Updated `/summarize` command to handle cases where summarization fails
354
+ + Fix bug in parsing content type of source document
312
355
  * **Refactored Options Class and Usage**
313
- + Renamed `options` variable to use `Options[]` method in ollama_chat script
314
- + Added `[](value)` method to Ollama::Options class for casting hashes
315
- + Updated options_spec.rb with tests for casting hashes and error handling
356
+ + Renamed `options` variable to use `Options[]` method in ollama_chat script
357
+ + Added `[](value)` method to Ollama::Options class for casting hashes
358
+ + Updated options_spec.rb with tests for casting hashes and error handling
316
359
  * **Refactored Web Search Command**
317
- + Added support for specifying a page number in `/web` command
318
- + Updated regular expression to match new format
319
- + Passed page number as an argument to `search_web` method
320
- + Updated content string to reference the query and sources correctly
360
+ + Added support for specifying a page number in `/web` command
361
+ + Updated regular expression to match new format
362
+ + Passed page number as an argument to `search_web` method
363
+ + Updated content string to reference the query and sources correctly
321
364
  * **DTO Class Changes**
322
- + Renamed `json_create` method to `from_hash` in Ollama::DTO class
323
- + Updated `as_json` method to remove now unnecessary hash creation
365
+ + Renamed `json_create` method to `from_hash` in Ollama::DTO class
366
+ + Updated `as_json` method to remove now unnecessary hash creation
324
367
  * **Message and Tool Spec Changes**
325
- + Removed `json_class` from JSON serialization in message_spec
326
- + Removed `json_class` from JSON serialization in tool_spec
368
+ + Removed `json_class` from JSON serialization in message_spec
369
+ + Removed `json_class` from JSON serialization in tool_spec
327
370
  * **Command Spec Changes**
328
- + Removed `json_class` from JSON serialization in various command specs (e.g. generate_spec, pull_spec, etc.)
371
+ + Removed `json_class` from JSON serialization in various command specs (e.g. generate_spec, pull_spec, etc.)
329
372
  * **Miscellaneous Changes**
330
- + Improved width calculation for text truncation
331
- + Updated FollowChat class to display evaluation statistics
332
- + Update OllamaChatConfig to use EOT instead of end for heredoc syntax
333
- + Add .keep file to tmp directory
373
+ + Improved width calculation for text truncation
374
+ + Updated FollowChat class to display evaluation statistics
375
+ + Update OllamaChatConfig to use EOT instead of end for heredoc syntax
376
+ + Add .keep file to tmp directory
334
377
 
335
378
  ## 2024-08-30 v0.1.0
336
379
 
@@ -339,18 +382,18 @@
339
382
  #### Significant Changes
340
383
 
341
384
  * **Document Splitting and Embedding Functionality**: Added `Ollama::Documents` class with methods for adding documents, checking existence, deleting documents, and finding similar documents.
342
- + Introduced two types of caches: `MemoryCache` and `RedisCache`
343
- + Implemented `SemanticSplitter` class to split text into sentences based on semantic similarity
385
+ + Introduced two types of caches: `MemoryCache` and `RedisCache`
386
+ + Implemented `SemanticSplitter` class to split text into sentences based on semantic similarity
344
387
  * **Improved Ollama Chat Client**: Added support for document embeddings and web/file RAG
345
- + Allowed configuration per yaml file
346
- + Parse user input for URLs or files to send images to multimodal models
388
+ + Allowed configuration per yaml file
389
+ + Parse user input for URLs or files to send images to multimodal models
347
390
  * **Redis Docker Service**: Set `REDIS_URL` environment variable to `redis://localhost:9736`
348
- + Added Redis service to `docker-compose.yml`
391
+ + Added Redis service to `docker-compose.yml`
349
392
  * **Status Display and Progress Updates**: Added infobar.label = response.status when available
350
- + Updated infobar with progress message on each call if total and completed are set
351
- + Display error message from response.error if present
393
+ + Updated infobar with progress message on each call if total and completed are set
394
+ + Display error message from response.error if present
352
395
  * **Refactored Chat Commands**: Simplified regular expression patterns for `/pop`, `/save`, `/load`, and `/image` commands
353
- + Added whitespace to some command patterns for better readability
396
+ + Added whitespace to some command patterns for better readability
354
397
 
355
398
  #### Other Changes
356
399
 
@@ -366,13 +409,13 @@
366
409
  ## 2024-08-16 v0.0.1
367
410
 
368
411
  * **New Features**
369
- + Added missing options parameter to Embed command
370
- + Documented new `/api/embed` endpoint
412
+ + Added missing options parameter to Embed command
413
+ + Documented new `/api/embed` endpoint
371
414
  * **Improvements**
372
- + Improved example in README.md
415
+ + Improved example in README.md
373
416
  * **Code Refactoring**
374
- + Renamed `client` to `ollama` in client and command specs
375
- + Updated expectations to use `ollama` instead of `client`
417
+ + Renamed `client` to `ollama` in client and command specs
418
+ + Updated expectations to use `ollama` instead of `client`
376
419
 
377
420
  ## 2024-08-12 v0.0.0
378
421