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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea205e7dc0418f74e20575287b89c71e46e3a92322352043bea8ebb93134f629
4
- data.tar.gz: e0254ec2f71b7e2539eee9315d0134716cd1a00494324ad3727d2f7b81129145
3
+ metadata.gz: cf57f6eea0f76d479dd4775772fe20d43a85d70b3e06869ae842923fb9e7bb7f
4
+ data.tar.gz: 18d439e6c5d24af612d67deaf2221b83485b401c8a39f2e49fe96c4540fe0829
5
5
  SHA512:
6
- metadata.gz: 50c4ac988c537de057a6b87cf8183f40572f9fb9b3136686e75604643c4aa70e5fac398e3492053d2f10e2229d205f6ec9992fac15ac30bcc8716c0a3d429ce2
7
- data.tar.gz: fc74eb93e1d69f1378571c47a95d9aafe53b1aa888da1091e293e915cbcfe48a138f434e00bbaf8941b8c4cb93d5ae057639b447bf6368adfe7bb5db781e7370
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[Wrapper]
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]
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Ollama
8
- VERSION = "0.7.0"
8
+ VERSION = "0.8.0"
9
9
  end
10
10
  end
@@ -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
- ��)'�;sU���\"X
2
- {_Q2�q�?�##9F`t��+j E�����k����݅ �!=xMP��Z!gK{xO/I��4,�5ԁ}=8�Ѻ&�����F~B�|� ��z�����Y�r�>b�nR�u#�'>�ܦ4u�D����u��*��m �m��휊�*̪A.� ��6c& ��V�q��W�#��1���1��������L�4�؀lX�ǎ���������c儆�x�ZJh訙� 8%�Y,z굄QÔ^�=M��p�X�h���Y����QQTG���� Y����>��jV6�ե��P�7E�Zn��5�%?�E�m�K8Udџd8>�u}������K���진�6�5�7"}�IT�&8��1��$�
1
+ ���u2�Ɲ�H����\�?��ˑ���D
2
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-ollama
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file