llm_specs 0.2.2 → 0.2.3
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 +4 -4
- data/README.md +4 -1
- data/lib/llm_specs/cache.rb +3 -3
- data/lib/llm_specs/version.rb +1 -1
- data/lib/llm_specs.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4126e322ed9ddf2308743fd52c9f7f89fbe0b8a10b6e0544239ae2d9263b09d
|
4
|
+
data.tar.gz: 63f1ca60bc8b47b9f44e36f55c5a2689807f00be6b9fc10c2c660ea23c93faa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 688f25a8ac8e0b0ad898599c2c5828673f54adcec5e7a48218df64cda0a858d1c5b7607d06d13f3a27be10ae995f9d6e45df9ea5d0023d666870d9ffe09601aa
|
7
|
+
data.tar.gz: 51b64c28c7a0df534a8fca27b98df54087b636f98d198d076f0ec2ef819872d4899dd050b7dfcd95b0998002be52ff5c88304e1936512b92d475a97ab9924ccd
|
data/README.md
CHANGED
@@ -22,6 +22,8 @@ models = LLMSpecs.gemini # provider specific models
|
|
22
22
|
models = LLMSpecs.anthropic
|
23
23
|
models = LLMSpecs.openai
|
24
24
|
models = LLMSpecs.deepseek
|
25
|
+
|
26
|
+
providers = LLMSpecs.providers # a list of all providers covers by Parsera API
|
25
27
|
```
|
26
28
|
|
27
29
|
### Find a model by ID
|
@@ -91,7 +93,7 @@ model.embeddings_output?
|
|
91
93
|
|
92
94
|
Pricing methods:
|
93
95
|
```ruby
|
94
|
-
model.
|
96
|
+
model.pricing # => returns a hash:
|
95
97
|
# {
|
96
98
|
# text_tokens: {
|
97
99
|
# standard: {
|
@@ -115,6 +117,7 @@ model.input_pricing # => returns a hash:
|
|
115
117
|
# }
|
116
118
|
|
117
119
|
model.pricing.dig(:text_tokens, :standard, :input_per_million)
|
120
|
+
# input/output pricing
|
118
121
|
model.input_pricing # 15.0 => $ per 1M input tokens (default to pricing[:text_tokens][:standard][:input_per_million])
|
119
122
|
model.output_pricing # 75.0 => $ per 1M output tokens
|
120
123
|
|
data/lib/llm_specs/cache.rb
CHANGED
@@ -10,7 +10,7 @@ module LLMSpecs
|
|
10
10
|
return read if valid?
|
11
11
|
yield.tap { write it }
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def read
|
15
15
|
File.read(@file)
|
16
16
|
end
|
@@ -22,11 +22,11 @@ module LLMSpecs
|
|
22
22
|
def valid?
|
23
23
|
exist? && fresh?
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def exist?
|
27
27
|
File.exist?(@file)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def fresh?
|
31
31
|
Time.now - File.mtime(@file) < @ttl
|
32
32
|
end
|
data/lib/llm_specs/version.rb
CHANGED
data/lib/llm_specs.rb
CHANGED
@@ -21,6 +21,10 @@ module LLMSpecs
|
|
21
21
|
@models ||= Catalog.new(api_uri: API_URI, cache_path: cache_path).models
|
22
22
|
end
|
23
23
|
|
24
|
+
def providers
|
25
|
+
models.map(&:provider).uniq
|
26
|
+
end
|
27
|
+
|
24
28
|
%i[anthropic deepseek gemini openai].each do |prov|
|
25
29
|
define_method(prov) { models.where(provider: prov.to_s) }
|
26
30
|
end
|