elelem-ollama 0.2.1 → 0.3.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/.agents/backlog/001-think-and-model-options.md +53 -0
- data/.agents/backlog/002-readme.md +41 -0
- data/.agents/backlog/003-gem-metadata-links.md +65 -0
- data/.agents/backlog/004-release-changelog-constraint.md +38 -0
- data/.github/workflows/release.yml +63 -0
- data/.release-please-manifest.json +3 -0
- data/.rubocop.yml +62 -0
- data/CHANGELOG.md +13 -0
- data/lib/elelem/ollama/provider.rb +11 -11
- data/lib/elelem/ollama/version.rb +1 -1
- data/lib/elelem/ollama.rb +4 -4
- data/release-please-config.json +12 -0
- data/spec/elelem/ollama/provider_spec.rb +8 -8
- metadata +25 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a56e44e8f55172f691f4107e8dee15f44c8f929788bc1e55a81963827c4286d
|
|
4
|
+
data.tar.gz: 045f9971b788874fb64e1e64ff0d3a093937f7a18d5b35262073cbb7b8f1ed1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85b7f9e596e1ef536d76e7b3ec7ac00707c89c636408e75a20f1c7f2c8c469e8190eee23f8e2104338bfe511c74c3100087ca574c8500226cf2118cc65738cbd
|
|
7
|
+
data.tar.gz: d6376f0e56de9eff1a08212d2d72d8de07af241d0f5d30a51b4937eb9a1dab35c50d3e65c85732c1d044d2c86a96d1276f29743b98b5473f7d0964d4ad3a76c2
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
As a `user running models through Ollama`, I `want OLLAMA_THINK and
|
|
2
|
+
model options such as context size to reach Ollama in the form it
|
|
3
|
+
expects`, so that `thinking and num_ctx work without editing code`.
|
|
4
|
+
|
|
5
|
+
# SYNOPSIS
|
|
6
|
+
|
|
7
|
+
Send `think` as a boolean or level, and let users set Ollama options.
|
|
8
|
+
|
|
9
|
+
# DESCRIPTION
|
|
10
|
+
|
|
11
|
+
`OLLAMA_THINK` is read with `ENV.fetch` and passed through unchanged
|
|
12
|
+
(lib/elelem/ollama.rb:16), so the request body carries a string such as
|
|
13
|
+
`"true"` (provider.rb:72). Ollama's `/api/chat` expects `think` to be a
|
|
14
|
+
boolean, or `"low"`, `"medium"` or `"high"` for models that take a
|
|
15
|
+
level. `"true"` and `"false"` may be rejected or ignored.
|
|
16
|
+
|
|
17
|
+
The provider accepts `options:` (sent as the request's `options`, for
|
|
18
|
+
values such as `num_ctx`, `temperature`, `seed`) and `params:` (merged
|
|
19
|
+
into the top level of the request body) (provider.rb:31-32, :66-75).
|
|
20
|
+
Nothing sets either: the provider block in lib/elelem/ollama.rb passes
|
|
21
|
+
only model, host, think and keep_alive. A user cannot raise the context
|
|
22
|
+
window without writing a plugin, and Ollama's default context is small
|
|
23
|
+
for an agent with tools.
|
|
24
|
+
|
|
25
|
+
Proposed:
|
|
26
|
+
|
|
27
|
+
* Map `OLLAMA_THINK=true|false` (any case) to booleans; pass `low`,
|
|
28
|
+
`medium` and `high` through; reject or warn on anything else.
|
|
29
|
+
* Expose options through environment variables, for example
|
|
30
|
+
`OLLAMA_NUM_CTX`, and decide in design whether to accept a general
|
|
31
|
+
form (such as `OLLAMA_OPTIONS` as JSON) as well.
|
|
32
|
+
* Accept the same values through provider options from core, if core
|
|
33
|
+
passes more than `model:`.
|
|
34
|
+
|
|
35
|
+
# SEE ALSO
|
|
36
|
+
|
|
37
|
+
* [ ] lib/elelem/ollama.rb:12-19 - provider block
|
|
38
|
+
* [ ] lib/elelem/ollama/provider.rb:26-46 - constructor
|
|
39
|
+
* [ ] lib/elelem/ollama/provider.rb:66-76 - build_request_body
|
|
40
|
+
* [ ] spec/elelem/ollama/provider_spec.rb
|
|
41
|
+
* [ ] Formerly elelem-sh/elelem.sh#27
|
|
42
|
+
|
|
43
|
+
# Tasks
|
|
44
|
+
|
|
45
|
+
* [ ] TBD (filled in design mode)
|
|
46
|
+
|
|
47
|
+
# Acceptance Criteria
|
|
48
|
+
|
|
49
|
+
* [ ] `OLLAMA_THINK=true` sends `"think": true`; `false` sends `false`
|
|
50
|
+
* [ ] `OLLAMA_THINK=high` sends `"think": "high"`
|
|
51
|
+
* [ ] An unset `OLLAMA_THINK` sends no `think` key, as today
|
|
52
|
+
* [ ] `OLLAMA_NUM_CTX=8192` sends `"options": {"num_ctx": 8192}`
|
|
53
|
+
* [ ] Specs check the request body for each case
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
As a `person who wants to use a local Ollama model with elelem`, I
|
|
2
|
+
`want a README in the elelem-ollama repository`, so that `I can
|
|
3
|
+
install it and pick a model and host without reading the code`.
|
|
4
|
+
|
|
5
|
+
# SYNOPSIS
|
|
6
|
+
|
|
7
|
+
Add a short README.
|
|
8
|
+
|
|
9
|
+
# DESCRIPTION
|
|
10
|
+
|
|
11
|
+
The repository has no README. It should cover:
|
|
12
|
+
|
|
13
|
+
* Install, and that Ollama must be running with the model pulled.
|
|
14
|
+
* Select the provider: `elelem chat -p ollama`, and `--model NAME`,
|
|
15
|
+
which overrides `OLLAMA_MODEL`.
|
|
16
|
+
* Environment variables: `OLLAMA_MODEL` (default `gpt-oss:latest`),
|
|
17
|
+
`OLLAMA_HOST` (default `localhost:11434`), `OLLAMA_THINK` and
|
|
18
|
+
`OLLAMA_KEEP_ALIVE`, plus any added by the options story.
|
|
19
|
+
* A link to https://elelem.sh/plugins/ollama/ for the full guide.
|
|
20
|
+
|
|
21
|
+
The elelem.sh plugin page can be the source for the text. Show
|
|
22
|
+
commands without a leading `$`.
|
|
23
|
+
|
|
24
|
+
# SEE ALSO
|
|
25
|
+
|
|
26
|
+
* [ ] lib/elelem/ollama.rb:12-19 - provider block and environment
|
|
27
|
+
* [ ] exe/elelem-ollama
|
|
28
|
+
* [ ] .agents/backlog/001-think-and-model-options.md
|
|
29
|
+
* [ ] https://elelem.sh/plugins/ollama/
|
|
30
|
+
* [ ] Formerly elelem-sh/elelem.sh#23
|
|
31
|
+
|
|
32
|
+
# Tasks
|
|
33
|
+
|
|
34
|
+
* [ ] TBD (filled in design mode)
|
|
35
|
+
|
|
36
|
+
# Acceptance Criteria
|
|
37
|
+
|
|
38
|
+
* [ ] README.md exists and covers install, provider selection, and
|
|
39
|
+
every environment variable the provider reads
|
|
40
|
+
* [ ] Defaults in the README match lib/elelem/ollama.rb
|
|
41
|
+
* [ ] Commands have no leading `$`
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
As a `person who finds elelem-ollama on RubyGems`, I `want the
|
|
2
|
+
gem page to link to the plugin's documentation, backlog and
|
|
3
|
+
changelog`, so that `I can learn how to use it and see known
|
|
4
|
+
problems without GitHub Issues`.
|
|
5
|
+
|
|
6
|
+
# SYNOPSIS
|
|
7
|
+
|
|
8
|
+
Point the gemspec homepage at elelem.sh and add the standard links.
|
|
9
|
+
|
|
10
|
+
# DESCRIPTION
|
|
11
|
+
|
|
12
|
+
RubyGems shows `homepage_uri` and the other `metadata` links on every
|
|
13
|
+
gem page. Today `elelem-ollama.gemspec` sets `spec.homepage`
|
|
14
|
+
to the site root (https://elelem.sh) and sets only `homepage_uri`,
|
|
15
|
+
`source_code_uri`, `allowed_push_host` and
|
|
16
|
+
`rubygems_mfa_required`.
|
|
17
|
+
There is no documentation, bug tracker or changelog link.
|
|
18
|
+
|
|
19
|
+
Proposed change:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
spec.homepage = "https://elelem.sh/plugins/ollama/"
|
|
23
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
24
|
+
spec.metadata["source_code_uri"] = "https://github.com/elelem-sh/ollama"
|
|
25
|
+
spec.metadata["documentation_uri"] = spec.homepage
|
|
26
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/elelem-sh/ollama/tree/main/.agents/backlog"
|
|
27
|
+
spec.metadata["changelog_uri"] = "https://github.com/elelem-sh/ollama/blob/main/CHANGELOG.md"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The original proposal pointed `bug_tracker_uri` at GitHub Issues on
|
|
31
|
+
elelem-sh/elelem.sh, filtered by label. That no longer fits: the
|
|
32
|
+
project is moving its backlog out of GitHub Issues and into
|
|
33
|
+
`.agents/backlog` story files in each repository, so the bug tracker
|
|
34
|
+
link points at this repository's backlog directory instead.
|
|
35
|
+
|
|
36
|
+
/man/ollama/ redirects to /plugins/ollama/ on elelem.sh, so a
|
|
37
|
+
separate documentation_uri adds nothing. Point both at the plugin page.
|
|
38
|
+
|
|
39
|
+
There is no CHANGELOG.md on main yet. release-please writes one
|
|
40
|
+
on the first release, so ship the link with or after that release.
|
|
41
|
+
|
|
42
|
+
Keep `allowed_push_host` and `rubygems_mfa_required` as they are.
|
|
43
|
+
RubyGems only shows the new links after the next release.
|
|
44
|
+
|
|
45
|
+
# SEE ALSO
|
|
46
|
+
|
|
47
|
+
* [ ] elelem-ollama.gemspec:13 - spec.homepage
|
|
48
|
+
* [ ] elelem-ollama.gemspec:18 - source_code_uri
|
|
49
|
+
* [ ] .agents/backlog/ - where bug_tracker_uri will point
|
|
50
|
+
* [ ] Formerly elelem-sh/elelem.sh#41
|
|
51
|
+
|
|
52
|
+
# Tasks
|
|
53
|
+
|
|
54
|
+
* [ ] TBD (filled in design mode)
|
|
55
|
+
|
|
56
|
+
# Acceptance Criteria
|
|
57
|
+
|
|
58
|
+
* [ ] `spec.homepage` and `homepage_uri` are https://elelem.sh/plugins/ollama/
|
|
59
|
+
* [ ] `bug_tracker_uri` points at this repository's `.agents/backlog`,
|
|
60
|
+
not at GitHub Issues
|
|
61
|
+
* [ ] `changelog_uri` and `source_code_uri` point at this repository
|
|
62
|
+
* [ ] `allowed_push_host` and `rubygems_mfa_required` are unchanged
|
|
63
|
+
* [ ] `gem build` succeeds and `gem spec` on the built gem shows every
|
|
64
|
+
link
|
|
65
|
+
* [ ] Every link resolves (no 404) at release time
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
As a `user reading the elelem-ollama changelog`, I `want the release
|
|
2
|
+
notes to state the elelem version the gem really requires`, so that `I
|
|
3
|
+
do not install it against a core it cannot load with`.
|
|
4
|
+
|
|
5
|
+
# SYNOPSIS
|
|
6
|
+
|
|
7
|
+
Correct the elelem constraint in the 0.3.0 release notes before
|
|
8
|
+
merging.
|
|
9
|
+
|
|
10
|
+
# DESCRIPTION
|
|
11
|
+
|
|
12
|
+
The open release PR for 0.3.0 (release-please branch, commit 3412b5c)
|
|
13
|
+
adds a CHANGELOG.md whose only bug fix reads "require elelem ~> 0.12,
|
|
14
|
+
the floor builtins/skills actually need" (8c52b47). The gemspec on
|
|
15
|
+
main requires `>= 0.13, < 1` (elelem-ollama.gemspec:31). 8cf5b67
|
|
16
|
+
raised the floor to `~> 0.13` and 2fd539c (a chore, so it is not in
|
|
17
|
+
the changelog) widened it to `< 1`; neither change shows in the notes.
|
|
18
|
+
The release notes would tell users 0.12 works when it does not.
|
|
19
|
+
|
|
20
|
+
Fix the CHANGELOG.md in the release PR by hand before merging, so the
|
|
21
|
+
entry states `>= 0.13, < 1`.
|
|
22
|
+
|
|
23
|
+
# SEE ALSO
|
|
24
|
+
|
|
25
|
+
* [ ] elelem-ollama.gemspec:31 - elelem dependency
|
|
26
|
+
* [ ] release-please-config.json
|
|
27
|
+
* [ ] Formerly elelem-sh/elelem.sh#55
|
|
28
|
+
|
|
29
|
+
# Tasks
|
|
30
|
+
|
|
31
|
+
* [ ] TBD (filled in design mode)
|
|
32
|
+
|
|
33
|
+
# Acceptance Criteria
|
|
34
|
+
|
|
35
|
+
* [ ] The 0.3.0 changelog states the elelem requirement the gemspec
|
|
36
|
+
has (`>= 0.13, < 1`)
|
|
37
|
+
* [ ] No line in the changelog says `~> 0.12`
|
|
38
|
+
* [ ] 0.3.0 is released with the corrected changelog
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: release
|
|
12
|
+
cancel-in-progress: false
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
- uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
|
|
24
|
+
with:
|
|
25
|
+
ruby-version: "4.0"
|
|
26
|
+
bundler-cache: true
|
|
27
|
+
- run: bin/test
|
|
28
|
+
- run: bin/lint
|
|
29
|
+
|
|
30
|
+
release-please:
|
|
31
|
+
needs: test
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
permissions:
|
|
34
|
+
contents: write
|
|
35
|
+
issues: write
|
|
36
|
+
pull-requests: write
|
|
37
|
+
outputs:
|
|
38
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
39
|
+
steps:
|
|
40
|
+
- id: release
|
|
41
|
+
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
|
|
42
|
+
with:
|
|
43
|
+
config-file: release-please-config.json
|
|
44
|
+
manifest-file: .release-please-manifest.json
|
|
45
|
+
|
|
46
|
+
publish:
|
|
47
|
+
needs: release-please
|
|
48
|
+
if: needs.release-please.outputs.release_created == 'true'
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
permissions:
|
|
51
|
+
contents: write
|
|
52
|
+
id-token: write
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
55
|
+
with:
|
|
56
|
+
persist-credentials: false
|
|
57
|
+
- uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
|
|
58
|
+
with:
|
|
59
|
+
ruby-version: "4.0"
|
|
60
|
+
bundler-cache: true
|
|
61
|
+
- uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1.4.1
|
|
62
|
+
with:
|
|
63
|
+
await-release: false
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
NewCops: enable
|
|
3
|
+
TargetRubyVersion: 4.0
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
Exclude:
|
|
6
|
+
- "pkg/**/*"
|
|
7
|
+
- "bin/**/*"
|
|
8
|
+
- "vendor/**/*"
|
|
9
|
+
- "fixtures/**/*"
|
|
10
|
+
|
|
11
|
+
Metrics:
|
|
12
|
+
Enabled: false
|
|
13
|
+
|
|
14
|
+
Naming/PredicateMethod:
|
|
15
|
+
AllowedMethods:
|
|
16
|
+
- call
|
|
17
|
+
- run
|
|
18
|
+
- summarize
|
|
19
|
+
- prompt
|
|
20
|
+
|
|
21
|
+
Naming/MethodParameterName:
|
|
22
|
+
AllowedNames:
|
|
23
|
+
- me
|
|
24
|
+
- id
|
|
25
|
+
- as
|
|
26
|
+
- io
|
|
27
|
+
|
|
28
|
+
Style/GlobalVars:
|
|
29
|
+
Exclude:
|
|
30
|
+
- "spec/**/*"
|
|
31
|
+
|
|
32
|
+
Lint/EmptyBlock:
|
|
33
|
+
Exclude:
|
|
34
|
+
- "spec/**/*"
|
|
35
|
+
|
|
36
|
+
Lint/UselessDefaultValueArgument:
|
|
37
|
+
Enabled: false
|
|
38
|
+
|
|
39
|
+
Lint/RedundantRequireStatement:
|
|
40
|
+
Enabled: false
|
|
41
|
+
|
|
42
|
+
Lint/UnusedBlockArgument:
|
|
43
|
+
IgnoreEmptyBlocks: true
|
|
44
|
+
AllowUnusedKeywordArguments: true
|
|
45
|
+
|
|
46
|
+
Style/Documentation:
|
|
47
|
+
Enabled: false
|
|
48
|
+
|
|
49
|
+
Style/FormatStringToken:
|
|
50
|
+
Enabled: false
|
|
51
|
+
|
|
52
|
+
Style/FrozenStringLiteralComment:
|
|
53
|
+
Enabled: true
|
|
54
|
+
|
|
55
|
+
Style/StringLiterals:
|
|
56
|
+
EnforcedStyle: double_quotes
|
|
57
|
+
|
|
58
|
+
Style/StringLiteralsInInterpolation:
|
|
59
|
+
EnforcedStyle: double_quotes
|
|
60
|
+
|
|
61
|
+
Layout/LineLength:
|
|
62
|
+
Max: 120
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.3.0](https://github.com/elelem-sh/ollama/compare/v0.2.1...v0.3.0) (2026-11-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* accept model: from provider_options, fall back to ENV ([8cf5b67](https://github.com/elelem-sh/ollama/commit/8cf5b676a6a20d962b7c9b56f4e92e2a19c48a93))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* require elelem ~> 0.12, the floor builtins/skills actually need ([8c52b47](https://github.com/elelem-sh/ollama/commit/8c52b47e0c6931553f17945b04d42b373b7a98c6))
|
|
@@ -25,12 +25,12 @@ module Elelem
|
|
|
25
25
|
@http = http
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def fetch(messages, tools = [], &
|
|
28
|
+
def fetch(messages, tools = [], &)
|
|
29
29
|
tool_calls = []
|
|
30
30
|
body = build_request_body(messages, tools)
|
|
31
31
|
|
|
32
32
|
stream(body) do |event|
|
|
33
|
-
handle_event(event, tool_calls, &
|
|
33
|
+
handle_event(event, tool_calls, &)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
tool_calls
|
|
@@ -97,18 +97,18 @@ module Elelem
|
|
|
97
97
|
block.call(type: "thinking", text: message["thinking"]) if message["thinking"]
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
return unless message["tool_calls"]
|
|
101
|
+
|
|
102
|
+
parsed = parse_tool_calls(message["tool_calls"])
|
|
103
|
+
parsed.each { |tc| block.call(tc.merge(type: "doing")) }
|
|
104
|
+
tool_calls.concat(parsed)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
def stream(body)
|
|
107
|
+
def stream(body, &)
|
|
108
108
|
http.post(@uri, body: body) do |response|
|
|
109
109
|
raise "HTTP #{response.code}: #{response.body}" unless response.is_a?(Net::HTTPSuccess)
|
|
110
110
|
|
|
111
|
-
read_ndjson_stream(response)
|
|
111
|
+
read_ndjson_stream(response, &)
|
|
112
112
|
end
|
|
113
113
|
end
|
|
114
114
|
|
|
@@ -147,7 +147,7 @@ module Elelem
|
|
|
147
147
|
@open_timeout = open_timeout
|
|
148
148
|
end
|
|
149
149
|
|
|
150
|
-
def post(uri, body
|
|
150
|
+
def post(uri, body:, &)
|
|
151
151
|
request = Net::HTTP::Post.new(uri)
|
|
152
152
|
request["content-type"] = "application/json"
|
|
153
153
|
request.body = JSON.generate(body)
|
|
@@ -158,7 +158,7 @@ module Elelem
|
|
|
158
158
|
http.open_timeout = @open_timeout
|
|
159
159
|
|
|
160
160
|
http.start do |conn|
|
|
161
|
-
conn.request(request)
|
|
161
|
+
conn.request(request, &)
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
end
|
data/lib/elelem/ollama.rb
CHANGED
|
@@ -9,12 +9,12 @@ require_relative "ollama/version"
|
|
|
9
9
|
require_relative "ollama/provider"
|
|
10
10
|
|
|
11
11
|
Elelem.configure do |config|
|
|
12
|
-
config.provider(:ollama) do
|
|
12
|
+
config.provider(:ollama) do |model: nil, **|
|
|
13
13
|
Elelem::Ollama::Provider.new(
|
|
14
|
-
model: ENV.fetch("OLLAMA_MODEL", "gpt-oss:latest"),
|
|
14
|
+
model: model || ENV.fetch("OLLAMA_MODEL", "gpt-oss:latest"),
|
|
15
15
|
host: ENV.fetch("OLLAMA_HOST", "localhost:11434"),
|
|
16
|
-
think: ENV
|
|
17
|
-
keep_alive: ENV
|
|
16
|
+
think: ENV.fetch("OLLAMA_THINK", nil),
|
|
17
|
+
keep_alive: ENV.fetch("OLLAMA_KEEP_ALIVE", nil)
|
|
18
18
|
)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bootstrap-sha": "6d9ad118bc8dc867c2a7a67a5e685ea1a889bcdb",
|
|
3
|
+
"packages": {
|
|
4
|
+
".": {
|
|
5
|
+
"release-type": "ruby",
|
|
6
|
+
"package-name": "elelem-ollama",
|
|
7
|
+
"version-file": "lib/elelem/ollama/version.rb",
|
|
8
|
+
"bump-minor-pre-major": true,
|
|
9
|
+
"include-component-in-tag": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -8,8 +8,8 @@ RSpec.describe Elelem::Ollama::Provider do
|
|
|
8
8
|
let(:body) { http.body }
|
|
9
9
|
|
|
10
10
|
let(:response) do
|
|
11
|
-
|
|
12
|
-
allow(
|
|
11
|
+
Net::HTTPOK.new("1.1", "200", "OK").tap do |res|
|
|
12
|
+
allow(res).to receive(:read_body).and_yield(%({"done":true,"message":{}}\n))
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -30,7 +30,7 @@ RSpec.describe Elelem::Ollama::Provider do
|
|
|
30
30
|
|
|
31
31
|
describe "#fetch" do
|
|
32
32
|
it "sends only model, messages and stream by default" do
|
|
33
|
-
provider.fetch(messages)
|
|
33
|
+
provider.fetch(messages, nil)
|
|
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::Provider do
|
|
|
38
38
|
it "sends tools when present" do
|
|
39
39
|
tools = [{ type: "function", function: { name: "read" } }]
|
|
40
40
|
|
|
41
|
-
provider.fetch(messages, tools) {
|
|
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::Provider 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
|
-
provider.fetch(messages)
|
|
50
|
+
provider.fetch(messages, nil)
|
|
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::Provider do
|
|
|
57
57
|
let(:params) { { options: {} } }
|
|
58
58
|
|
|
59
59
|
it "omits options" do
|
|
60
|
-
provider.fetch(messages)
|
|
60
|
+
provider.fetch(messages, nil)
|
|
61
61
|
|
|
62
62
|
expect(body).not_to have_key(:options)
|
|
63
63
|
end
|
|
@@ -67,7 +67,7 @@ RSpec.describe Elelem::Ollama::Provider 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
|
-
provider.fetch(messages)
|
|
70
|
+
provider.fetch(messages, nil)
|
|
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::Provider do
|
|
|
77
77
|
let(:params) { { think: "low", params: { think: "high" } } }
|
|
78
78
|
|
|
79
79
|
it "prefers the passthrough value" do
|
|
80
|
-
provider.fetch(messages)
|
|
80
|
+
provider.fetch(messages, nil)
|
|
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.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mo khan
|
|
@@ -13,16 +13,22 @@ dependencies:
|
|
|
13
13
|
name: elelem
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.13'
|
|
19
|
+
- - "<"
|
|
17
20
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
21
|
+
version: '1'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
25
|
requirements:
|
|
23
|
-
- - "
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0.13'
|
|
29
|
+
- - "<"
|
|
24
30
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
31
|
+
version: '1'
|
|
26
32
|
- !ruby/object:Gem::Dependency
|
|
27
33
|
name: json
|
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -73,22 +79,32 @@ executables:
|
|
|
73
79
|
extensions: []
|
|
74
80
|
extra_rdoc_files: []
|
|
75
81
|
files:
|
|
82
|
+
- ".agents/backlog/001-think-and-model-options.md"
|
|
83
|
+
- ".agents/backlog/002-readme.md"
|
|
84
|
+
- ".agents/backlog/003-gem-metadata-links.md"
|
|
85
|
+
- ".agents/backlog/004-release-changelog-constraint.md"
|
|
86
|
+
- ".github/workflows/release.yml"
|
|
87
|
+
- ".release-please-manifest.json"
|
|
76
88
|
- ".rspec"
|
|
89
|
+
- ".rubocop.yml"
|
|
90
|
+
- CHANGELOG.md
|
|
77
91
|
- LICENSE.txt
|
|
78
92
|
- Rakefile
|
|
79
93
|
- exe/elelem-ollama
|
|
80
94
|
- lib/elelem/ollama.rb
|
|
81
95
|
- lib/elelem/ollama/provider.rb
|
|
82
96
|
- lib/elelem/ollama/version.rb
|
|
97
|
+
- release-please-config.json
|
|
83
98
|
- spec/elelem/ollama/provider_spec.rb
|
|
84
99
|
- spec/spec_helper.rb
|
|
85
|
-
homepage: https://
|
|
100
|
+
homepage: https://elelem.sh
|
|
86
101
|
licenses:
|
|
87
102
|
- MIT
|
|
88
103
|
metadata:
|
|
89
104
|
allowed_push_host: https://rubygems.org
|
|
90
|
-
homepage_uri: https://
|
|
91
|
-
source_code_uri: https://
|
|
105
|
+
homepage_uri: https://elelem.sh
|
|
106
|
+
source_code_uri: https://github.com/elelem-sh/ollama
|
|
107
|
+
rubygems_mfa_required: 'true'
|
|
92
108
|
rdoc_options: []
|
|
93
109
|
require_paths:
|
|
94
110
|
- lib
|
|
@@ -103,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
103
119
|
- !ruby/object:Gem::Version
|
|
104
120
|
version: '0'
|
|
105
121
|
requirements: []
|
|
106
|
-
rubygems_version: 4.0.
|
|
122
|
+
rubygems_version: 4.0.6
|
|
107
123
|
specification_version: 4
|
|
108
124
|
summary: An Ollama provider plugin for elelem.
|
|
109
125
|
test_files: []
|