ollama-ruby 0.5.0 → 0.7.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 +4 -4
- data/.envrc +1 -0
- data/CHANGES.md +84 -0
- data/README.md +10 -4
- data/Rakefile +2 -1
- data/bin/ollama_chat +367 -120
- data/bin/ollama_cli +3 -3
- data/bin/ollama_update +2 -0
- data/docker-compose.yml +3 -4
- data/lib/ollama/client.rb +2 -5
- data/lib/ollama/documents/cache/redis_cache.rb +11 -1
- data/lib/ollama/documents.rb +17 -7
- data/lib/ollama/image.rb +3 -1
- data/lib/ollama/utils/cache_fetcher.rb +38 -0
- data/lib/ollama/utils/chooser.rb +9 -3
- data/lib/ollama/utils/fetcher.rb +63 -36
- data/lib/ollama/utils/file_argument.rb +3 -1
- data/lib/ollama/utils/tags.rb +60 -6
- data/lib/ollama/utils/width.rb +5 -3
- data/lib/ollama/version.rb +1 -1
- data/lib/ollama.rb +4 -0
- data/ollama-ruby.gemspec +8 -7
- data/spec/ollama/image_spec.rb +5 -0
- data/spec/ollama/utils/cache_fetcher_spec.rb +43 -0
- data/spec/ollama/utils/fetcher_spec.rb +2 -2
- data/spec/ollama/utils/tags_spec.rb +26 -2
- data/spec/ollama/utils/width_spec.rb +82 -0
- data/spec/spec_helper.rb +1 -0
- metadata +36 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bdf85f296b631c52b44984eee6a5e6d98c82a4cfc4a5764529f4d46b3bdaba7
|
4
|
+
data.tar.gz: 05e391e492f85f8c6fb1106d49ff4118c26a0922c5978156e2f1364aad82299d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3f77296a526154ed46860a675515b864baa8c991933e76ceeb178b00037df844f20201ad200cb9df8d4fa105066fb40bb0248db3bb65c5bad81012ce3b7288
|
7
|
+
data.tar.gz: 1d25c9420fba86d992b77f29e4f4f57734dcbdaba864650f626af1c828262a9470f9c981da602335f8d3a03ef3cfc9773ad33d90d3e88a70a4d86be0518d762a
|
data/.envrc
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,89 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2024-10-03 v0.7.0
|
4
|
+
|
5
|
+
* **Refactor command line interface**
|
6
|
+
+ Moved case order
|
7
|
+
+ Renamed `/collection clear [tag]|change` to `/collection (clear|change)`
|
8
|
+
+ Improved help message, added /info
|
9
|
+
* **Update README.md**
|
10
|
+
+ Update README.md to reflect changed/added commands
|
11
|
+
* **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
|
15
|
+
* **Update read buffer size for tempfile writes**
|
16
|
+
+ Updated `tmp.write` to use a larger buffer size (**16KB**) in IO.popen block.
|
17
|
+
* **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
|
21
|
+
* **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
|
25
|
+
* **Fix Redis cache expiration logic**
|
26
|
+
+ Update `set` method to delete key expiration time is less than 1 second.
|
27
|
+
* **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
|
32
|
+
* **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
|
36
|
+
* **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
|
40
|
+
|
41
|
+
## 2024-09-30 v0.6.0
|
42
|
+
|
43
|
+
### Significant Changes
|
44
|
+
|
45
|
+
* **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
|
51
|
+
* **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
|
56
|
+
* **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`
|
60
|
+
|
61
|
+
### Other Changes
|
62
|
+
|
63
|
+
* **Updated dependencies**:
|
64
|
+
+ Updated version of `xdg` gem to **7.0**
|
65
|
+
+ Added `xdg` dependency to Rakefile
|
66
|
+
* **Refactored error handling**:
|
67
|
+
+ Warn message updated to include more context about the error
|
68
|
+
+ `warn` statement now mentions "while pulling model"
|
69
|
+
* **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
|
73
|
+
* **Refactored Ollama::Utils::Fetcher**:
|
74
|
+
+ Made instance methods private and only exposed class methods
|
75
|
+
+ Added `expose` method to `Ollama::Utils::FetcherSpec` for testing
|
76
|
+
* **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
|
80
|
+
* **Updated system prompt display**:
|
81
|
+
+ Changed `Ollama::Utils::Width.wrap` to `Ollama::Utils::ANSIMarkdown.parse` in `show_system_prompt` method
|
82
|
+
* **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
|
86
|
+
|
3
87
|
## 2024-09-26 v0.5.0
|
4
88
|
|
5
89
|
### New Features
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ This a chat client, that can be used to connect to an ollama server and enter a
|
|
34
34
|
chat converstation with a LLM. It can be called with the following arguments:
|
35
35
|
|
36
36
|
```
|
37
|
-
ollama_chat [OPTIONS]
|
37
|
+
Usage: ollama_chat [OPTIONS]
|
38
38
|
|
39
39
|
-f CONFIG config file to read
|
40
40
|
-u URL the ollama base url, OLLAMA_URL
|
@@ -42,10 +42,10 @@ ollama_chat [OPTIONS]
|
|
42
42
|
-s SYSTEM the system prompt to use as a file, OLLAMA_CHAT_SYSTEM
|
43
43
|
-c CHAT a saved chat conversation to load
|
44
44
|
-C COLLECTION name of the collection used in this conversation
|
45
|
-
-D DOCUMENT load document and add to collection (multiple)
|
45
|
+
-D DOCUMENT load document and add to embeddings collection (multiple)
|
46
46
|
-M use (empty) MemoryCache for this chat session
|
47
47
|
-E disable embeddings for this chat session
|
48
|
-
-
|
48
|
+
-V display the current version number and quit
|
49
49
|
-h this help
|
50
50
|
```
|
51
51
|
|
@@ -154,15 +154,21 @@ subject - the young, blue-eyed cat.
|
|
154
154
|
The following commands can be given inside the chat, if prefixed by a `/`:
|
155
155
|
|
156
156
|
```
|
157
|
+
/copy to copy last response to clipboard
|
157
158
|
/paste to paste content
|
158
159
|
/markdown toggle markdown output
|
160
|
+
/stream toggle stream output
|
161
|
+
/location toggle location submission
|
162
|
+
/voice( change) toggle voice output or change the voice
|
159
163
|
/list [n] list the last n / all conversation exchanges
|
160
164
|
/clear clear the whole conversation
|
161
165
|
/clobber clear the conversation and collection
|
162
166
|
/pop [n] pop the last n exchanges, defaults to 1
|
163
167
|
/model change the model
|
168
|
+
/system change system prompt (clears conversation)
|
164
169
|
/regenerate the last answer message
|
165
|
-
/collection clear
|
170
|
+
/collection( clear|change) change (default) collection or clear
|
171
|
+
/info show information for current session
|
166
172
|
/import source import the source's content
|
167
173
|
/summarize [n] source summarize the source's content in n words
|
168
174
|
/embedding toggle embedding paused or not
|
data/Rakefile
CHANGED
@@ -32,7 +32,6 @@ GemHadar do
|
|
32
32
|
dependency 'redis', '~> 5.0'
|
33
33
|
dependency 'numo-narray', '~> 0.9'
|
34
34
|
dependency 'more_math', '~> 1.1'
|
35
|
-
dependency 'sorted_set', '~> 1.0'
|
36
35
|
dependency 'mime-types', '~> 3.0'
|
37
36
|
dependency 'reverse_markdown', '~> 2.0'
|
38
37
|
dependency 'complex_config', '~> 0.22'
|
@@ -41,6 +40,8 @@ GemHadar do
|
|
41
40
|
dependency 'pdf-reader', '~> 2.0'
|
42
41
|
dependency 'logger', '~> 1.0'
|
43
42
|
dependency 'json', '~> 2.0'
|
43
|
+
dependency 'xdg', '~> 7.0'
|
44
|
+
dependency 'tins', '~> 1.34'
|
44
45
|
development_dependency 'all_images', '~> 0.4'
|
45
46
|
development_dependency 'rspec', '~> 3.2'
|
46
47
|
development_dependency 'webmock'
|