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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2653909fb5d73d8d77e59d831443339ab8729575eedc6cbf53dc38a8b6ac5cd9
|
|
4
|
+
data.tar.gz: 0613137206fd9a05635641d47eb8dd2bc062ea9e1c0cfeae93945d7ba13eb903
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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.
|
|
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.
|
|
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
|
|
112
|
+
rescue StandardError
|
|
113
113
|
[]
|
|
114
114
|
end
|
|
115
115
|
|