active_harness_pricing 0.1.0 → 0.1.2

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: ac53afc65a92dfd05822664fcb797fb9d785eba4be2148295e5ee898f1e2236b
4
- data.tar.gz: fa65d9618561a7f6d346713b7ec2000688e504cf6aa120db7b9282f54e5c79a4
3
+ metadata.gz: 2653909fb5d73d8d77e59d831443339ab8729575eedc6cbf53dc38a8b6ac5cd9
4
+ data.tar.gz: 0613137206fd9a05635641d47eb8dd2bc062ea9e1c0cfeae93945d7ba13eb903
5
5
  SHA512:
6
- metadata.gz: b1fd5891bee21ca2c575b7046b0dee73ce90791d58fb231ebc68633f96b2d7efac48bfb1ae6db1b0c5668e699cff36cf31cba592de4bf7a6ddd402a5baefd711
7
- data.tar.gz: 963a2238509aa0c4acf2017ed871e23a02aa5187c62275b787732e9141977b8606c11430f7202da87d9c0725b51ee6e4e4e66df8ba932c959bb269aaa19c6cc1
6
+ metadata.gz: df0c43417885adcdaa3847768c4876c7312209e668a5ff9e15ef76bd729a913ffb1fe26747081b0732d83127565c2c809fd253ce8c20a4f38549484051f4d123
7
+ data.tar.gz: 4b243ea1b8d27dccd2bf7ffe6db115266c41d8fb8c9870b743c32bff59c53975b2891a11c0577e29b24f2dbf0c2c06fdaf95f3efb1d09783151b76df9553f901
@@ -142,7 +142,7 @@ module ActiveHarness
142
142
  return [] unless File.exist?(cache_file)
143
143
  data = JSON.parse(File.read(cache_file), symbolize_names: true)
144
144
  data.is_a?(Array) ? data : []
145
- rescue JSON::ParserError
145
+ rescue StandardError
146
146
  []
147
147
  end
148
148
 
@@ -164,8 +164,8 @@ module ActiveHarness
164
164
  next [] unless ah_provider && allowed.include?(ah_provider)
165
165
 
166
166
  models_hash = provider_data.is_a?(Hash) ? (provider_data[:models] || {}) : {}
167
- models_hash.values.filter_map do |m|
168
- next unless m.is_a?(Hash) && m[:id]
167
+ models_hash.values.map do |m|
168
+ next nil unless m.is_a?(Hash) && m[:id]
169
169
 
170
170
  cost = m[:cost] || {}
171
171
  standard = {
@@ -186,7 +186,7 @@ module ActiveHarness
186
186
  output_modalities: Array(mods[:output]),
187
187
  pricing: standard.any? ? { text_tokens: { standard: standard } } : {}
188
188
  }
189
- end
189
+ end.compact
190
190
  end
191
191
  end
192
192
 
@@ -48,7 +48,7 @@ module ActiveHarness
48
48
 
49
49
  def all
50
50
  ensure_fresh_registry
51
- registry.filter_map { |raw| build_price(raw) }
51
+ registry.map { |raw| build_price(raw) }.compact
52
52
  end
53
53
 
54
54
  def preload!
@@ -109,7 +109,7 @@ module ActiveHarness
109
109
  return [] unless File.exist?(cache_file)
110
110
  data = JSON.parse(File.read(cache_file), symbolize_names: true)
111
111
  data.is_a?(Array) ? data : []
112
- rescue JSON::ParserError
112
+ rescue StandardError
113
113
  []
114
114
  end
115
115
 
@@ -3,5 +3,5 @@ require_relative "active_harness/pricing/models_dev"
3
3
  require_relative "active_harness/pricing/openrouter"
4
4
 
5
5
  module ActiveHarnessPricing
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.2"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_harness_pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - the-teacher