ollama-ruby 1.15.0 → 1.16.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/CHANGES.md +12 -0
- data/lib/ollama/client.rb +2 -0
- data/lib/ollama/errors.rb +16 -0
- data/lib/ollama/version.rb +1 -1
- data/ollama-ruby.gemspec +2 -2
- data/spec/ollama/client_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 12336647780f0ade66da333cfdc9aa2b6ef13d46104f1401753053d842fefe2c
|
|
4
|
+
data.tar.gz: 714a75014f7ec8ba5f11f8b947a8239830177bd61c52288fc7e5707067e265f5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca6f942ebe15774770d1ffba89ba0802050c1c403efb64f427ec3ee78bd744dd50e25b328078c06c1ff1895695f9d3d6294b42aa19b2e5dbe7908bdbc0872545
|
|
7
|
+
data.tar.gz: 86264aaeb4a1a8182ba9a1638fd9f598d6c7de385770e3fe98ef442081512a8cc881665691285a27fcd74885ab91d0afde05089f47bfd2495cdfaf79f95ebdce
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2025-12-09 v1.16.0
|
|
4
|
+
|
|
5
|
+
- Added support for handling HTTP 400 Bad Request errors
|
|
6
|
+
- Introduced new error class `Ollama::Errors::BadRequestError` for 400 status
|
|
7
|
+
codes
|
|
8
|
+
- Updated `Ollama::Client#request` method to raise `BadRequestError` for 400
|
|
9
|
+
responses
|
|
10
|
+
- Added test case in `spec/ollama/client_spec.rb` to verify 400 status code
|
|
11
|
+
handling
|
|
12
|
+
- Documented the new error class with example usage for think mode errors
|
|
13
|
+
- Maintained existing error handling for 404 and other status codes
|
|
14
|
+
|
|
3
15
|
## 2025-12-04 v1.15.0
|
|
4
16
|
|
|
5
17
|
- Added documentation for `ollama_ps` executable utility in README
|
data/lib/ollama/client.rb
CHANGED
|
@@ -173,6 +173,8 @@ class Ollama::Client
|
|
|
173
173
|
response_line = parse_json(l)
|
|
174
174
|
response_line and yielder.yield response_line
|
|
175
175
|
end
|
|
176
|
+
when 400
|
|
177
|
+
raise Ollama::Errors::BadRequestError, "#{response.status} #{response.body.inspect}"
|
|
176
178
|
when 404
|
|
177
179
|
raise Ollama::Errors::NotFoundError, "#{response.status} #{response.body.inspect}"
|
|
178
180
|
else
|
data/lib/ollama/errors.rb
CHANGED
|
@@ -29,6 +29,22 @@ module Ollama
|
|
|
29
29
|
class NotFoundError < Error
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Ollama error class for handling cases where a requested resource is not
|
|
33
|
+
# found.
|
|
34
|
+
#
|
|
35
|
+
# This exception is raised when the Ollama API returns a 400 status code,
|
|
36
|
+
# indicating that the request was bad, e. g. think mode was requested from
|
|
37
|
+
# a non-thinking model.
|
|
38
|
+
#
|
|
39
|
+
# @example Handling a bad request error
|
|
40
|
+
# begin
|
|
41
|
+
# ollama.generate(model: 'llama3.1', prompt: 'Hello World', think: true)
|
|
42
|
+
# rescue Ollama::Errors::BadRequestError
|
|
43
|
+
# puts "Thinking not supported"
|
|
44
|
+
# end
|
|
45
|
+
class BadRequestError < Error
|
|
46
|
+
end
|
|
47
|
+
|
|
32
48
|
# Ollama error class for handling timeout errors when communicating with
|
|
33
49
|
# the Ollama API.
|
|
34
50
|
#
|
data/lib/ollama/version.rb
CHANGED
data/ollama-ruby.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: ollama-ruby 1.
|
|
2
|
+
# stub: ollama-ruby 1.16.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "ollama-ruby".freeze
|
|
6
|
-
s.version = "1.
|
|
6
|
+
s.version = "1.16.0".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
data/spec/ollama/client_spec.rb
CHANGED
|
@@ -71,6 +71,13 @@ describe Ollama::Client do
|
|
|
71
71
|
}.to raise_error(Ollama::Errors::Error)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
it 'can raise error based on status code 400' do
|
|
75
|
+
expect(excon).to receive(:send).and_return(double(status: 400, body: '{}'))
|
|
76
|
+
expect {
|
|
77
|
+
ollama.generate(model: 'llama3.1', prompt: 'Hello World', think: true)
|
|
78
|
+
}.to raise_error(Ollama::Errors::BadRequestError)
|
|
79
|
+
end
|
|
80
|
+
|
|
74
81
|
it 'can raise error based on status code 404' do
|
|
75
82
|
expect(excon).to receive(:send).and_return(double(status: 404, body: '{}'))
|
|
76
83
|
expect {
|