async-ollama 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3365078c11cba990bad7d5c3b8d7edaac51bd1efd99bb2e73dd78d1fddf0778f
4
- data.tar.gz: bdfb803fcd92ae54a6382b75e3008026939903eec083667bd2f1d93dd1b57504
3
+ metadata.gz: b063f95dd3bfc375203e52136932e15e7fdb060c5e8c2c88714285679d4ed535
4
+ data.tar.gz: a431d19a4817acf9d77ab225f22dfe523d0e04826f4ad87e615bd7c6d22d20f9
5
5
  SHA512:
6
- metadata.gz: f523362fc9d63392e8fe0cd2704a04e768e3cbcc115af561bc500b6a9604d4aee02765d0625b91fba2bdede669f38e66aff70dbd1489fcd72389912d5a2cf252
7
- data.tar.gz: 1fead04badd7785a75e54e5faa9e007cd132d8f6764588f8d3cf5cbc2e1fbbbfa475012bc546f83ae135ea2104745765337f143395243a459c769b89a2a41819
6
+ metadata.gz: ac83698f0c120ede1b595509da72e83ab81faffe50bed02e3aebf01e5b66579699d2329fbdaff0e0f087813677fc6f338029bccda9d62d0ed6726c26586e9973
7
+ data.tar.gz: 148408b29f5aafd3ce3d71c5ecd3f2eadbd496736893049e01701e52e214188912725a3ba13245b261d5c02e159725a29998493e7739aed6f8e0e0a08db0ad4b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -4,7 +4,9 @@
4
4
  # Copyright, 2024, by Samuel Williams.
5
5
 
6
6
  require "async/rest/resource"
7
+
7
8
  require_relative "generate"
9
+ require_relative "models"
8
10
 
9
11
  module Async
10
12
  module Ollama
@@ -27,6 +29,10 @@ module Async
27
29
  Generate.new(resource, value: response.read, metadata: response.headers)
28
30
  end
29
31
  end
32
+
33
+ def models
34
+ Models.get(self.with(path: "/api/tags"))
35
+ end
30
36
  end
31
37
  end
32
38
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2024, by Samuel Williams.
5
+
6
+ require "async/rest/representation"
7
+ require_relative "wrapper"
8
+
9
+ module Async
10
+ module Ollama
11
+ class Models < Async::REST::Representation[Wrapper]
12
+ def names
13
+ self.value[:models].map{|model| model[:name]}
14
+ end
15
+ end
16
+ end
17
+ end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Ollama
8
- VERSION = "0.3.0"
8
+ VERSION = "0.4.0"
9
9
  end
10
10
  end
@@ -85,7 +85,10 @@ module Async
85
85
  end
86
86
 
87
87
  def parser_for(response)
88
- case response.headers["content-type"]
88
+ content_type = response.headers["content-type"]
89
+ media_type = content_type.split(";").first
90
+
91
+ case media_type
89
92
  when APPLICATION_JSON
90
93
  return Async::REST::Wrapper::JSON::Parser
91
94
  when APPLICATION_JSON_STREAM
data.tar.gz.sig CHANGED
Binary file
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,7 +37,7 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2024-09-12 00:00:00.000000000 Z
40
+ date: 2024-11-25 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: async
@@ -76,6 +76,7 @@ files:
76
76
  - lib/async/ollama.rb
77
77
  - lib/async/ollama/client.rb
78
78
  - lib/async/ollama/generate.rb
79
+ - lib/async/ollama/models.rb
79
80
  - lib/async/ollama/version.rb
80
81
  - lib/async/ollama/wrapper.rb
81
82
  - license.md
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  requirements: []
104
- rubygems_version: 3.5.11
105
+ rubygems_version: 3.5.22
105
106
  signing_key:
106
107
  specification_version: 4
107
108
  summary: A asynchronous interface to the ollama chat service
metadata.gz.sig CHANGED
Binary file