ollama-ruby 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.envrc +1 -0
- data/CHANGES.md +103 -0
- data/README.md +23 -17
- data/Rakefile +3 -0
- data/bin/ollama_chat +451 -176
- data/bin/ollama_cli +11 -9
- data/docker-compose.yml +3 -4
- data/lib/ollama/client.rb +2 -2
- data/lib/ollama/documents/cache/redis_backed_memory_cache.rb +5 -11
- data/lib/ollama/documents/cache/redis_cache.rb +11 -5
- data/lib/ollama/documents/splitters/character.rb +8 -6
- data/lib/ollama/documents/splitters/semantic.rb +1 -1
- data/lib/ollama/documents.rb +12 -5
- data/lib/ollama/utils/cache_fetcher.rb +38 -0
- data/lib/ollama/utils/fetcher.rb +67 -19
- data/lib/ollama/utils/file_argument.rb +1 -1
- data/lib/ollama/version.rb +1 -1
- data/lib/ollama.rb +1 -0
- data/ollama-ruby.gemspec +10 -7
- data/spec/ollama/documents/redis_backed_memory_cache_spec.rb +11 -0
- data/spec/ollama/documents/redis_cache_spec.rb +21 -1
- data/spec/ollama/documents/splitters/character_spec.rb +28 -14
- data/spec/ollama/utils/cache_fetcher_spec.rb +42 -0
- data/spec/ollama/utils/fetcher_spec.rb +41 -1
- data/spec/spec_helper.rb +1 -0
- metadata +50 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7858cf04c638fa3369fe7d96d96eed12e5553fd17abe9ed48c1eaf25113ffb
|
4
|
+
data.tar.gz: ccb56d4b85a6e74256feb52ac5642d50850f7b980f9060dbb9fdf933985be746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f36aacde399c0be934425f12669fa6cc55cdfad938ea8157c5195db8c2367243cc6470dff24ec5bf83800079732bfa271450a4779246335c45c2bedbb0e3a6cf
|
7
|
+
data.tar.gz: 56e465f056934210a6cc45677d52518d8adb76e8702561248b6db4cd1e4b129cfd22eedbdcc0c935f69bf85eeb9bc324aef6876f39969942af4529978a277756
|
data/.envrc
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,108 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## 2024-09-26 v0.5.0
|
4
|
+
|
5
|
+
### New Features
|
6
|
+
|
7
|
+
* Add stdin substitution and variable expansion to `ollama_cli`:
|
8
|
+
+ Added support for `%{stdin}` in prompts, substituting with actual input
|
9
|
+
+ Added `-P` option to set prompt variables from command line arguments
|
10
|
+
+ Added handling of multiple placeholders in prompts
|
11
|
+
* Add proxy support to Ollama chat client:
|
12
|
+
+ Add `tins/xt/hash_union` gem to dependencies
|
13
|
+
+ Update `OllamaChatConfig` with new `proxy` option
|
14
|
+
+ Modify `http_options` method to include proxy and SSL verify peer options
|
15
|
+
based on config settings
|
16
|
+
* Refactor source embedding logic:
|
17
|
+
+ Simplified explicit case statement.
|
18
|
+
+ Added `inputs or return` to ensure early exit when splitting cannot be
|
19
|
+
done
|
20
|
+
* Update Ollama chat script to embed, import or summarize sources:
|
21
|
+
+ Added `require 'tins/xt/full'`
|
22
|
+
+ Updated prompts in `OllamaChatConfig` to include embed prompt and
|
23
|
+
summarize prompt with word count option
|
24
|
+
+ Modified `import_document` method to use `embed_source` instead of
|
25
|
+
importing document as a whole
|
26
|
+
+ Added `embed_source` method to parse source content and add it to the
|
27
|
+
conversation via embeddings
|
28
|
+
+ Updated `summarize` method to take an optional word count parameter
|
29
|
+
+ Added `toggle_markdown` method to toggle markdown output on/off
|
30
|
+
+ Added `show_embedding` method to display embedding status
|
31
|
+
+ Updated `choose_collection` method to include new collection option
|
32
|
+
+ Added `set_embedding` method to set embedding model and paused embedding
|
33
|
+
+ Updated `info` method to display current model, collection stats, and
|
34
|
+
embedding status
|
35
|
+
|
36
|
+
### Improvements
|
37
|
+
|
38
|
+
* Improve conversation listing command:
|
39
|
+
+ Allow `list_conversation` method to take an optional argument for the
|
40
|
+
number of messages to display
|
41
|
+
+ Added support for displaying a specific number of messages with `/list
|
42
|
+
[n]`
|
43
|
+
* Update chat commands' quit functionality:
|
44
|
+
+ Moved `/quit` command to exit the program
|
45
|
+
* Refactor OllamaChatConfig web prompt:
|
46
|
+
+ Add `web` prompt to `OllamaChatConfig` class
|
47
|
+
+ Replace hardcoded content with variable `content`
|
48
|
+
+ Use `query` and `results` variables instead of interpolating strings
|
49
|
+
* Add Redis cache expiration support:
|
50
|
+
+ Added `ex` option to `initialize` method in
|
51
|
+
`lib/ollama/documents/cache/redis_cache.rb`
|
52
|
+
+ Updated `[]=` method in `lib/ollama/documents/cache/redis_cache.rb` to
|
53
|
+
use Redis expiration
|
54
|
+
+ Added `ttl` method in `lib/ollama/documents/cache/redis_cache.rb` to get
|
55
|
+
key TTL
|
56
|
+
* Update Redis and Redis-backed memory cache to use `object_class` parameter:
|
57
|
+
+ Added `object_class` parameter to `RedisBackedMemoryCache` and
|
58
|
+
`RedisCache` constructors
|
59
|
+
+ Updated tests in `redis_backed_memory_cache_spec.rb` and
|
60
|
+
`redis_cache_spec.rb` to reflect new behavior
|
61
|
+
|
62
|
+
### Bug Fixes
|
63
|
+
|
64
|
+
* Update semantic splitter to use `include_separator` option from opts:
|
65
|
+
+ Added flexibility by allowing `include_separator` option to be passed in
|
66
|
+
through opts
|
67
|
+
+ Updated `include_separator` parameter to use
|
68
|
+
`opts.fetch(:include_separator, true)` instead of hardcoding value to
|
69
|
+
True.
|
70
|
+
|
71
|
+
### Refactoring
|
72
|
+
|
73
|
+
* Refactor `file_argument.rb` for better readability:
|
74
|
+
+ Update conditionals in Ollama::Utils::FileArgument module
|
75
|
+
+ Simplify logic with improved variable usage
|
76
|
+
+ Remove unnecessary elsif statement
|
77
|
+
+ Use consistent indentation and spacing throughout the code
|
78
|
+
* Refactor Redis-backed memory cache:
|
79
|
+
+ Removed `pre` and `unpre` methods from `Ollama::Documents` use mixin
|
80
|
+
instead.
|
81
|
+
|
82
|
+
### Documentation
|
83
|
+
|
84
|
+
* Update README.md to reflect changes in `ollama_chat` functionality.
|
85
|
+
+ Modified commands:
|
86
|
+
- `/import source` to import the source's content
|
87
|
+
- `/embed source` to embed the source's content
|
88
|
+
- `/summarize [n] source` to summarize the source's content in n words
|
89
|
+
- `/embedding` to toggle embedding paused or not
|
90
|
+
- `/embed source` to embed the source's content
|
91
|
+
|
92
|
+
### Dependencies and Date Updates
|
93
|
+
|
94
|
+
* Update dependencies and date in gemspec:
|
95
|
+
+ Added `logger` (~> **1.0**) and `json` (~> **2.0**) as runtime
|
96
|
+
dependencies to Rakefile and ollama-ruby.gemspec.
|
97
|
+
+ Updated date in ollama-ruby.gemspec from "2024-09-21" to "2024-09-22".
|
98
|
+
+ Added `require 'logger'` to lib/ollama.rb.
|
99
|
+
|
100
|
+
### Other Changes
|
101
|
+
|
102
|
+
* Add SSL no verify option to OllamaChatConfig and Utils::Fetcher:
|
103
|
+
+ Added `ssl_no_verify` option to OllamaChatConfig
|
104
|
+
+ Updated Utils::Fetcher to take an
|
105
|
+
|
3
106
|
## 2024-09-21 v0.4.0
|
4
107
|
|
5
108
|
### Change Log for **1.2.3**
|
data/README.md
CHANGED
@@ -45,7 +45,6 @@ ollama_chat [OPTIONS]
|
|
45
45
|
-D DOCUMENT load document and add to collection (multiple)
|
46
46
|
-M use (empty) MemoryCache for this chat session
|
47
47
|
-E disable embeddings for this chat session
|
48
|
-
-v use voice output
|
49
48
|
-h this help
|
50
49
|
```
|
51
50
|
|
@@ -154,21 +153,28 @@ subject - the young, blue-eyed cat.
|
|
154
153
|
The following commands can be given inside the chat, if prefixed by a `/`:
|
155
154
|
|
156
155
|
```
|
157
|
-
/
|
158
|
-
/
|
159
|
-
/
|
160
|
-
/
|
161
|
-
/
|
162
|
-
/
|
163
|
-
/
|
164
|
-
/
|
165
|
-
/
|
166
|
-
/
|
167
|
-
/
|
168
|
-
/
|
169
|
-
/
|
170
|
-
/
|
171
|
-
/
|
156
|
+
/copy to copy last response to clipboard
|
157
|
+
/paste to paste content
|
158
|
+
/markdown toggle markdown output
|
159
|
+
/stream toggle stream output
|
160
|
+
/voice( change) toggle voice output or change the voice
|
161
|
+
/list [n] list the last n / all conversation exchanges
|
162
|
+
/clear clear the whole conversation
|
163
|
+
/clobber clear the conversation and collection
|
164
|
+
/pop [n] pop the last n exchanges, defaults to 1
|
165
|
+
/model change the model
|
166
|
+
/system change system prompt (clears conversation)
|
167
|
+
/regenerate the last answer message
|
168
|
+
/collection clear [tag]|change clear or show stats of current collection
|
169
|
+
/import source import the source's content
|
170
|
+
/summarize [n] source summarize the source's content in n words
|
171
|
+
/embedding toggle embedding paused or not
|
172
|
+
/embed source embed the source's content
|
173
|
+
/web [n] query query web search & return n or 1 results
|
174
|
+
/save filename store conversation messages
|
175
|
+
/load filename load conversation messages
|
176
|
+
/quit to quit
|
177
|
+
/help to view this help
|
172
178
|
```
|
173
179
|
|
174
180
|
### ollama\_console
|
@@ -462,7 +468,7 @@ The homepage of this library is located at
|
|
462
468
|
|
463
469
|
## Author
|
464
470
|
|
465
|
-
<b>Ollama</b> was written by Florian Frank [Florian Frank](mailto:flori@ping.de)
|
471
|
+
<b>Ollama Ruby</b> was written by Florian Frank [Florian Frank](mailto:flori@ping.de)
|
466
472
|
|
467
473
|
## License
|
468
474
|
|
data/Rakefile
CHANGED
@@ -39,6 +39,9 @@ GemHadar do
|
|
39
39
|
dependency 'search_ui', '~> 0.0'
|
40
40
|
dependency 'amatch', '~> 0.4.1'
|
41
41
|
dependency 'pdf-reader', '~> 2.0'
|
42
|
+
dependency 'logger', '~> 1.0'
|
43
|
+
dependency 'json', '~> 2.0'
|
44
|
+
dependency 'xdg', '~> 7.0'
|
42
45
|
development_dependency 'all_images', '~> 0.4'
|
43
46
|
development_dependency 'rspec', '~> 3.2'
|
44
47
|
development_dependency 'webmock'
|