async-ollama 0.7.0 → 0.8.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
- checksums.yaml.gz.sig +0 -0
- data/bake/async/ollama.rb +1 -5
- data/lib/async/ollama/generate.rb +1 -1
- data/lib/async/ollama/version.rb +1 -1
- data/lib/async/ollama/wrapper.rb +18 -0
- data.tar.gz.sig +2 -2
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf57f6eea0f76d479dd4775772fe20d43a85d70b3e06869ae842923fb9e7bb7f
|
4
|
+
data.tar.gz: 18d439e6c5d24af612d67deaf2221b83485b401c8a39f2e49fe96c4540fe0829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9742560a8fc515088f6a9e15008892e001d84b0fb439af817a2a78885a9cfed4ef969ac73801e942e2bf6e830b2c844207f80a4a1af2889218207f0aa516ebf2
|
7
|
+
data.tar.gz: 8a9d307856bfdf9bf883222a036f505e2e43f1dda370b7231ad84ffd2d5e2f1db8e03c3ddf488198b295e2254a1979b712fe966d9e82774775ebe11c5e4e149f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/async/ollama.rb
CHANGED
@@ -17,11 +17,7 @@ end
|
|
17
17
|
|
18
18
|
# Pulls the specified models from the Ollama API. If no models are specified, but there is a default model, it will pull that one.
|
19
19
|
# @parameter models [Array(String)] The names of the models to pull.
|
20
|
-
def pull(models)
|
21
|
-
if models.empty?
|
22
|
-
models = [Async::Ollama::Client.default_model]
|
23
|
-
end
|
24
|
-
|
20
|
+
def pull(models: [Async::Ollama::MODEL])
|
25
21
|
Async::Ollama::Client.open do |client|
|
26
22
|
models.each do |model|
|
27
23
|
client.pull(model) do |response|
|
@@ -9,7 +9,7 @@ require_relative "wrapper"
|
|
9
9
|
module Async
|
10
10
|
module Ollama
|
11
11
|
# Represents a generated response from the Ollama API.
|
12
|
-
class Generate < Async::REST::Representation[
|
12
|
+
class Generate < Async::REST::Representation[GenerateWrapper]
|
13
13
|
# @returns [String | nil] The generated response, or nil if not present.
|
14
14
|
def response
|
15
15
|
self.value[:response]
|
data/lib/async/ollama/version.rb
CHANGED
data/lib/async/ollama/wrapper.rb
CHANGED
@@ -139,6 +139,24 @@ module Async
|
|
139
139
|
content_type = response.headers["content-type"]
|
140
140
|
media_type = content_type.split(";").first
|
141
141
|
|
142
|
+
case media_type
|
143
|
+
when APPLICATION_JSON
|
144
|
+
return Async::REST::Wrapper::JSON::Parser
|
145
|
+
when APPLICATION_JSON_STREAM
|
146
|
+
return StreamingParser
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Wraps generate-specific HTTP responses for the Ollama API, selecting the appropriate parser.
|
152
|
+
class GenerateWrapper < Wrapper
|
153
|
+
# Selects the appropriate parser for the generate HTTP response.
|
154
|
+
# @parameter response [Protocol::HTTP::Response] The HTTP response object.
|
155
|
+
# @returns [Class] The parser class to use.
|
156
|
+
def parser_for(response)
|
157
|
+
content_type = response.headers["content-type"]
|
158
|
+
media_type = content_type.split(";").first
|
159
|
+
|
142
160
|
case media_type
|
143
161
|
when APPLICATION_JSON
|
144
162
|
return Async::REST::Wrapper::JSON::Parser
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
���u2�Ɲ�H����\�?��ˑ���D
|
2
|
+
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|