llm_specs 0.2.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 871a4897a574a252d630c5cf9732ba40bb1110aaa8b8f5acc4d0e1776124f4c2
4
- data.tar.gz: e52ffa700f2aa1d0cf04a4a4692708e396331ad62e24e26ecb636681ca962834
3
+ metadata.gz: d4126e322ed9ddf2308743fd52c9f7f89fbe0b8a10b6e0544239ae2d9263b09d
4
+ data.tar.gz: 63f1ca60bc8b47b9f44e36f55c5a2689807f00be6b9fc10c2c660ea23c93faa1
5
5
  SHA512:
6
- metadata.gz: efb7f63e343f54e3537e87157ecdbc665681bbc413113480699fe2a9595d4e08257c41f198a679690541f0bc1c01d91b06f39c7c208296dd4ebb12ecd70d6d6a
7
- data.tar.gz: 8d54eb1c1a54a86c534f68f549d71b3464cf1ba23f363054bcddd553723e278a70698d5fac40cea24a10410ab8971b8786bf949097885edb951056c167bfdcaf
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.input_pricing # => returns a hash:
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
 
@@ -11,16 +11,24 @@ module LLMSpecs
11
11
  yield.tap { write it }
12
12
  end
13
13
 
14
- def valid?
15
- File.exist?(@file) && (Time.now - File.mtime(@file) < @ttl)
16
- end
17
-
18
14
  def read
19
15
  File.read(@file)
20
16
  end
21
17
 
22
18
  def write(data)
23
- File.write(@file, data) if data
19
+ File.write(@file, data)
20
+ end
21
+
22
+ def valid?
23
+ exist? && fresh?
24
+ end
25
+
26
+ def exist?
27
+ File.exist?(@file)
28
+ end
29
+
30
+ def fresh?
31
+ Time.now - File.mtime(@file) < @ttl
24
32
  end
25
33
  end
26
34
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module LLMSpecs
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.3"
4
4
  end
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
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.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Power