llm_specs 0.1.4 → 0.1.5

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: 4604604399ad4ef7ff18abb3c93064b17a1d6e2fa068e5b6204b1bf7c4303b68
4
- data.tar.gz: 6592a5f8cdaed54ff6688a846d979ff7b41bdfe94f4a9b1144fa29714b61205c
3
+ metadata.gz: 79037b669b30677efe9d924a7b8083f426f943f54d66ea975de9e3b9757bc85f
4
+ data.tar.gz: d778a3d458ef032b79cf451a6c1ccfd28ba8aac22472613c7535153bed8f4498
5
5
  SHA512:
6
- metadata.gz: fae24b7964fef5f7533c905e061f12d83f9b7817b1e3b769ad8a27dfcd2292135e4d9eac4637b389de9f006a4d103b2f4b3c7ead7f59122cea15656d58fb8eb7
7
- data.tar.gz: 749105c92098bc6105c2e7e28d8def9a9d44fb7eb3cd40da77e1e747fd5c3f3017307ca479bc3badcd5ff106b6eb31b428afebab68576c0d009992d4efe64f03
6
+ metadata.gz: ef501f8bdc9550691ce68b124d047115bb66c3c14b0ee73a4bd49405d05be00ed03d021f9afb25f51c26a11378c2220be1dc57fd16d8ce423a19e396571b7a50
7
+ data.tar.gz: 791ea85d4793569859f2389fbbfd0ecf847a365f2e1004805fff5410b60cda2234fa2588fbf7fc54a17e4708dbd642aa1dfc5c36b9bacd636d777573745bd165
@@ -8,9 +8,7 @@ module LLMSpecs
8
8
 
9
9
  def fetch
10
10
  return read if valid?
11
- data = yield
12
- write(data)
13
- data
11
+ yield.tap { write(it) }
14
12
  end
15
13
 
16
14
  def valid?
@@ -14,10 +14,14 @@ module LLMSpecs
14
14
 
15
15
  def fetch
16
16
  @cache.fetch do
17
- response = Net::HTTP.get_response(@uri)
18
- raise FetchError.new(response) unless response.is_a? Net::HTTPSuccess
19
- JSON.parse(response.body, symbolize_names: true)
17
+ parse Net::HTTP.get_response(@uri).tap(&:value) # raises Net::HTTPError if not 2xx
20
18
  end
21
19
  end
20
+
21
+ def parse(response)
22
+ JSON.parse(response.body, symbolize_names: true)
23
+ end
22
24
  end
23
25
  end
26
+
27
+
@@ -5,12 +5,4 @@ module LLMSpecs
5
5
  super("Couldn't find model with id='#{id}'")
6
6
  end
7
7
  end
8
-
9
- class FetchError < StandardError
10
- attr_reader :response
11
- def initialize(response)
12
- @response = response
13
- super("HTTP fetch failed (status: #{response.status})")
14
- end
15
- end
16
8
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module LLMSpecs
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_specs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Power
@@ -43,7 +43,6 @@ files:
43
43
  - lib/llm_specs/errors.rb
44
44
  - lib/llm_specs/model.rb
45
45
  - lib/llm_specs/version.rb
46
- - models.json
47
46
  - sig/llm_specs.rbs
48
47
  homepage: https://github.com/max-power/llm_specs
49
48
  licenses: