ollama-ruby 0.3.2 → 0.5.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: 9304634c783477787792071f039d6941222bcca0577cd59cdbc5103f820ea299
4
- data.tar.gz: 9edc7eaf98c0601e08bb5cde23fc2d46b745982172caea349982d8867790166a
3
+ metadata.gz: 3efc65090c37d60db61417738d3780ce7b86af805c86e1828421b86e83c11c13
4
+ data.tar.gz: 3d18b6d92320c889bcef7b566a818867cbd55ff29a519738e3dd0e524d766aa6
5
5
  SHA512:
6
- metadata.gz: 0bda727610f0793d6c360a63c76b2c42e032109f34011ed7cbd54df5663102c3738498be836adcb00645e4ce407cab1f422737970b83a3fa757ea0b4d90d8453
7
- data.tar.gz: b9df134561b2a44accfdc1ec6da68eb0b3b9b5ce64c2d64c744834a0b74cbfde8018e270977440224d0433c681e7a203d272453e391b85a3d32f34e3b0c790ca
6
+ metadata.gz: 5086fa3669dd9a19d917a528dacf8073cf250400ef91210086b96a99e62468f3b232d55a1a04240537ab79f58cb9015c5f591b46b61e60424e068107133a944a
7
+ data.tar.gz: 93837384222c5221e8b70db3034fe8ac4dbb86c379bd583a66c29b500376e6fc6bacba2419d673cf84f1b81a2b13b2cbd0ac8d32a2280e09e1c46acc48de5f8b
data/CHANGES.md CHANGED
@@ -1,5 +1,136 @@
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
+
106
+ ## 2024-09-21 v0.4.0
107
+
108
+ ### Change Log for **1.2.3**
109
+
110
+ #### New Features
111
+
112
+ * Added `-E` option to disable embeddings for this chat session.
113
+ * Added `-M` option to load document embeddings into (empty) MemoryCache for this chat session.
114
+ * Added CSV parsing support to `ollama_chat`.
115
+ * Improved error handling in `Ollama::Utils::Fetcher` methods.
116
+
117
+ #### Bug Fixes
118
+
119
+ * Handle case in `ollama_chat` where responses don't provide counts, display 0
120
+ rates instead.
121
+
122
+ #### Refactoring and Improvements
123
+
124
+ * Updated eval count and rate display in FollowChat class.
125
+ * Refactor system prompt display and chunk listing in chat output.
126
+ * Refactor cache implementation to use Ollama::Documents::Cache::Common module.
127
+ * Improved system prompt formatting in `ollama_chat` script.
128
+ * Renamed `tags` method to `tags_set` in `Ollama::Documents::Record` class.
129
+
130
+ #### Documentation
131
+
132
+ * Added comments to ColorizeTexts utility class.
133
+
3
134
  ## 2024-09-15 v0.3.2
4
135
 
5
136
  * Add color support to chooser module:
data/README.md CHANGED
@@ -43,6 +43,8 @@ ollama_chat [OPTIONS]
43
43
  -c CHAT a saved chat conversation to load
44
44
  -C COLLECTION name of the collection used in this conversation
45
45
  -D DOCUMENT load document and add to collection (multiple)
46
+ -M use (empty) MemoryCache for this chat session
47
+ -E disable embeddings for this chat session
46
48
  -v use voice output
47
49
  -h this help
48
50
  ```
@@ -152,21 +154,24 @@ subject - the young, blue-eyed cat.
152
154
  The following commands can be given inside the chat, if prefixed by a `/`:
153
155
 
154
156
  ```
155
- /paste to paste content
156
- /markdown toggle markdown output
157
- /list list the messages of the conversation
158
- /clear clear the conversation messages
159
- /clobber clear conversation messages and collection
160
- /pop [n] pop the last n exchanges, defaults to 1
161
- /model change the model
162
- /regenerate the last answer message
163
- /collection clear [tag]|stats|change|new clear or show stats of current collection
164
- /summarize source summarize the URL/file source's content
165
- /web [n] query query web search & return n or 1 results
166
- /save filename store conversation messages
167
- /load filename load conversation messages
168
- /quit to quit
169
- /help to view this help
157
+ /paste to paste content
158
+ /markdown toggle markdown output
159
+ /list [n] list the last n / all conversation exchanges
160
+ /clear clear the whole conversation
161
+ /clobber clear the conversation and collection
162
+ /pop [n] pop the last n exchanges, defaults to 1
163
+ /model change the model
164
+ /regenerate the last answer message
165
+ /collection clear [tag]|change clear or show stats of current collection
166
+ /import source import the source's content
167
+ /summarize [n] source summarize the source's content in n words
168
+ /embedding toggle embedding paused or not
169
+ /embed source embed the source's content
170
+ /web [n] query query web search & return n or 1 results
171
+ /save filename store conversation messages
172
+ /load filename load conversation messages
173
+ /quit to quit
174
+ /help to view this help
170
175
  ```
171
176
 
172
177
  ### ollama\_console
@@ -460,7 +465,7 @@ The homepage of this library is located at
460
465
 
461
466
  ## Author
462
467
 
463
- <b>Ollama</b> was written by Florian Frank [Florian Frank](mailto:flori@ping.de)
468
+ <b>Ollama Ruby</b> was written by Florian Frank [Florian Frank](mailto:flori@ping.de)
464
469
 
465
470
  ## License
466
471
 
data/Rakefile CHANGED
@@ -13,7 +13,8 @@ GemHadar do
13
13
  description 'Library that allows interacting with the Ollama API'
14
14
  test_dir 'spec'
15
15
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.AppleDouble', '.bundle',
16
- '.yardoc', 'tags', 'errors.lst', 'cscope.out', 'coverage', 'tmp', 'corpus'
16
+ '.yardoc', 'doc', 'tags', 'errors.lst', 'cscope.out', 'coverage', 'tmp',
17
+ 'corpus'
17
18
  package_ignore '.all_images.yml', '.tool-versions', '.gitignore', 'VERSION',
18
19
  '.rspec', *Dir.glob('.github/**/*', File::FNM_DOTMATCH)
19
20
  readme 'README.md'
@@ -38,9 +39,13 @@ GemHadar do
38
39
  dependency 'search_ui', '~> 0.0'
39
40
  dependency 'amatch', '~> 0.4.1'
40
41
  dependency 'pdf-reader', '~> 2.0'
42
+ dependency 'logger', '~> 1.0'
43
+ dependency 'json', '~> 2.0'
41
44
  development_dependency 'all_images', '~> 0.4'
42
45
  development_dependency 'rspec', '~> 3.2'
43
46
  development_dependency 'webmock'
47
+ development_dependency 'debug'
48
+ development_dependency 'simplecov'
44
49
 
45
50
  licenses << 'MIT'
46
51