elelem-ollama 0.2.0 → 0.2.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b701e2cfd20804a661ca5bbf43a8bf108e3aad7bcfe93020d0be259a49a5e228
|
|
4
|
+
data.tar.gz: 1db79dc70f15a2e8e2eab2823f208865ae6ca022ed7430b6e0c9fddb6f146823
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b92bcb6efcc49525ab8b1a07f1165090eae166508acbf4fe11a9bde2c2b074d7535a76146f15ef7b1d48a04e63b6cd669a76cc64d68016fd056b400e9c491b61
|
|
7
|
+
data.tar.gz: cda6bc9ebe68911fe3271bd8fe9efff474c58541b86b0bd5f86bf25500a223faf8cbee068887bca4ca9bda85ebf5d58b8c495568b8616a0869e46deac07dd13d
|
data/lib/elelem/ollama.rb
CHANGED
|
@@ -6,11 +6,11 @@ require "net/http"
|
|
|
6
6
|
require "uri"
|
|
7
7
|
|
|
8
8
|
require_relative "ollama/version"
|
|
9
|
-
require_relative "ollama/
|
|
9
|
+
require_relative "ollama/provider"
|
|
10
10
|
|
|
11
11
|
Elelem.configure do |config|
|
|
12
12
|
config.provider(:ollama) do
|
|
13
|
-
Elelem::Ollama::
|
|
13
|
+
Elelem::Ollama::Provider.new(
|
|
14
14
|
model: ENV.fetch("OLLAMA_MODEL", "gpt-oss:latest"),
|
|
15
15
|
host: ENV.fetch("OLLAMA_HOST", "localhost:11434"),
|
|
16
16
|
think: ENV["OLLAMA_THINK"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
RSpec.describe Elelem::Ollama::
|
|
4
|
-
subject(:
|
|
3
|
+
RSpec.describe Elelem::Ollama::Provider do
|
|
4
|
+
subject(:provider) { described_class.new(model: "gpt-oss:latest", http:, **params) }
|
|
5
5
|
|
|
6
6
|
let(:params) { {} }
|
|
7
7
|
let(:messages) { [{ role: "user", content: "hi" }] }
|
|
@@ -30,7 +30,7 @@ RSpec.describe Elelem::Ollama::Client do
|
|
|
30
30
|
|
|
31
31
|
describe "#fetch" do
|
|
32
32
|
it "sends only model, messages and stream by default" do
|
|
33
|
-
|
|
33
|
+
provider.fetch(messages) { }
|
|
34
34
|
|
|
35
35
|
expect(body).to eq(model: "gpt-oss:latest", messages:, stream: true)
|
|
36
36
|
end
|
|
@@ -38,7 +38,7 @@ RSpec.describe Elelem::Ollama::Client do
|
|
|
38
38
|
it "sends tools when present" do
|
|
39
39
|
tools = [{ type: "function", function: { name: "read" } }]
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
provider.fetch(messages, tools) { }
|
|
42
42
|
|
|
43
43
|
expect(body[:tools]).to eq(tools)
|
|
44
44
|
end
|
|
@@ -47,7 +47,7 @@ RSpec.describe Elelem::Ollama::Client do
|
|
|
47
47
|
let(:params) { { think: "high", keep_alive: "30m", options: { num_ctx: 32_768 } } }
|
|
48
48
|
|
|
49
49
|
it "sends them in the request body" do
|
|
50
|
-
|
|
50
|
+
provider.fetch(messages) { }
|
|
51
51
|
|
|
52
52
|
expect(body).to include(think: "high", keep_alive: "30m", options: { num_ctx: 32_768 })
|
|
53
53
|
end
|
|
@@ -57,7 +57,7 @@ RSpec.describe Elelem::Ollama::Client do
|
|
|
57
57
|
let(:params) { { options: {} } }
|
|
58
58
|
|
|
59
59
|
it "omits options" do
|
|
60
|
-
|
|
60
|
+
provider.fetch(messages) { }
|
|
61
61
|
|
|
62
62
|
expect(body).not_to have_key(:options)
|
|
63
63
|
end
|
|
@@ -67,7 +67,7 @@ RSpec.describe Elelem::Ollama::Client do
|
|
|
67
67
|
let(:params) { { params: { format: "json", truncate: false, top_logprobs: 3 } } }
|
|
68
68
|
|
|
69
69
|
it "merges them into the request body" do
|
|
70
|
-
|
|
70
|
+
provider.fetch(messages) { }
|
|
71
71
|
|
|
72
72
|
expect(body).to include(format: "json", truncate: false, top_logprobs: 3)
|
|
73
73
|
end
|
|
@@ -77,7 +77,7 @@ RSpec.describe Elelem::Ollama::Client do
|
|
|
77
77
|
let(:params) { { think: "low", params: { think: "high" } } }
|
|
78
78
|
|
|
79
79
|
it "prefers the passthrough value" do
|
|
80
|
-
|
|
80
|
+
provider.fetch(messages) { }
|
|
81
81
|
|
|
82
82
|
expect(body[:think]).to eq("high")
|
|
83
83
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: elelem-ollama
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mo khan
|
|
@@ -78,9 +78,9 @@ files:
|
|
|
78
78
|
- Rakefile
|
|
79
79
|
- exe/elelem-ollama
|
|
80
80
|
- lib/elelem/ollama.rb
|
|
81
|
-
- lib/elelem/ollama/
|
|
81
|
+
- lib/elelem/ollama/provider.rb
|
|
82
82
|
- lib/elelem/ollama/version.rb
|
|
83
|
-
- spec/elelem/ollama/
|
|
83
|
+
- spec/elelem/ollama/provider_spec.rb
|
|
84
84
|
- spec/spec_helper.rb
|
|
85
85
|
homepage: https://src.mokhan.ca/elelem/ollama
|
|
86
86
|
licenses:
|