ollama-client 0.2.6 → 0.2.7
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/CHANGELOG.md +9 -0
- data/README.md +208 -25
- data/RELEASE_NOTES_v0.2.6.md +41 -0
- data/docs/AREAS_FOR_CONSIDERATION.md +325 -0
- data/docs/FEATURES_ADDED.md +12 -1
- data/examples/README.md +14 -0
- data/examples/basic_chat.rb +0 -0
- data/examples/basic_generate.rb +0 -0
- data/examples/mcp_executor.rb +39 -0
- data/examples/mcp_http_executor.rb +45 -0
- data/examples/tool_calling_parsing.rb +0 -0
- data/examples/tool_dto_example.rb +0 -0
- data/lib/ollama/config.rb +5 -3
- data/lib/ollama/embeddings.rb +40 -22
- data/lib/ollama/mcp/http_client.rb +149 -0
- data/lib/ollama/mcp/stdio_client.rb +146 -0
- data/lib/ollama/mcp/tools_bridge.rb +72 -0
- data/lib/ollama/mcp.rb +31 -0
- data/lib/ollama/options.rb +3 -1
- data/lib/ollama/version.rb +1 -1
- data/lib/ollama_client.rb +10 -5
- metadata +10 -2
data/lib/ollama/version.rb
CHANGED
data/lib/ollama_client.rb
CHANGED
|
@@ -18,19 +18,23 @@ require_relative "ollama/chat_session"
|
|
|
18
18
|
require_relative "ollama/agent/messages"
|
|
19
19
|
require_relative "ollama/agent/planner"
|
|
20
20
|
require_relative "ollama/agent/executor"
|
|
21
|
+
require_relative "ollama/mcp"
|
|
21
22
|
require_relative "ollama/personas"
|
|
22
23
|
|
|
23
24
|
# Main entry point for OllamaClient gem
|
|
24
25
|
#
|
|
25
26
|
# ⚠️ THREAD SAFETY WARNING:
|
|
26
|
-
# Global configuration
|
|
27
|
-
#
|
|
28
|
-
#
|
|
27
|
+
# Global configuration access is protected by mutex, but modifying
|
|
28
|
+
# global config while clients are active can cause race conditions.
|
|
29
|
+
# For concurrent agents or multi-threaded applications, prefer
|
|
30
|
+
# per-client configuration (recommended):
|
|
29
31
|
#
|
|
30
32
|
# config = Ollama::Config.new
|
|
31
33
|
# config.model = "llama3.1"
|
|
32
34
|
# client = Ollama::Client.new(config: config)
|
|
33
35
|
#
|
|
36
|
+
# Each client instance is thread-safe when using its own config.
|
|
37
|
+
#
|
|
34
38
|
module OllamaClient
|
|
35
39
|
@config_mutex = Mutex.new
|
|
36
40
|
@warned_thread_config = false
|
|
@@ -44,8 +48,9 @@ module OllamaClient
|
|
|
44
48
|
def self.configure
|
|
45
49
|
if Thread.current != Thread.main && !@warned_thread_config
|
|
46
50
|
@warned_thread_config = true
|
|
47
|
-
msg = "[ollama-client] Global OllamaClient.configure
|
|
48
|
-
"
|
|
51
|
+
msg = "[ollama-client] Global OllamaClient.configure called from non-main thread. " \
|
|
52
|
+
"While access is mutex-protected, modifying global config concurrently can cause " \
|
|
53
|
+
"race conditions. Prefer per-client config: Ollama::Client.new(config: ...)"
|
|
49
54
|
warn(msg)
|
|
50
55
|
end
|
|
51
56
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ollama-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shubham Taywade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-02-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bigdecimal
|
|
@@ -69,7 +69,9 @@ files:
|
|
|
69
69
|
- CONTRIBUTING.md
|
|
70
70
|
- LICENSE.txt
|
|
71
71
|
- README.md
|
|
72
|
+
- RELEASE_NOTES_v0.2.6.md
|
|
72
73
|
- Rakefile
|
|
74
|
+
- docs/AREAS_FOR_CONSIDERATION.md
|
|
73
75
|
- docs/CLOUD.md
|
|
74
76
|
- docs/CONSOLE_IMPROVEMENTS.md
|
|
75
77
|
- docs/EXAMPLE_REORGANIZATION.md
|
|
@@ -91,6 +93,8 @@ files:
|
|
|
91
93
|
- examples/README.md
|
|
92
94
|
- examples/basic_chat.rb
|
|
93
95
|
- examples/basic_generate.rb
|
|
96
|
+
- examples/mcp_executor.rb
|
|
97
|
+
- examples/mcp_http_executor.rb
|
|
94
98
|
- examples/tool_calling_parsing.rb
|
|
95
99
|
- examples/tool_dto_example.rb
|
|
96
100
|
- exe/ollama-client
|
|
@@ -104,6 +108,10 @@ files:
|
|
|
104
108
|
- lib/ollama/dto.rb
|
|
105
109
|
- lib/ollama/embeddings.rb
|
|
106
110
|
- lib/ollama/errors.rb
|
|
111
|
+
- lib/ollama/mcp.rb
|
|
112
|
+
- lib/ollama/mcp/http_client.rb
|
|
113
|
+
- lib/ollama/mcp/stdio_client.rb
|
|
114
|
+
- lib/ollama/mcp/tools_bridge.rb
|
|
107
115
|
- lib/ollama/options.rb
|
|
108
116
|
- lib/ollama/personas.rb
|
|
109
117
|
- lib/ollama/response.rb
|