riffer 0.52.1 → 0.53.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.release-please-manifest.json +1 -1
  3. data/CHANGELOG.md +7 -0
  4. data/docs/AGENTS.md +15 -0
  5. data/docs/CATALOG.md +205 -0
  6. data/docs/CONFIGURATION.md +35 -23
  7. data/docs/MESSAGES.md +1 -1
  8. data/docs/SERIALIZATION.md +1 -0
  9. data/docs/TRACING.md +2 -1
  10. data/docs/providers/AMAZON_BEDROCK.md +2 -0
  11. data/docs/providers/ANTHROPIC.md +2 -0
  12. data/docs/providers/AZURE_OPENAI.md +2 -0
  13. data/docs/providers/CUSTOM_PROVIDERS.md +15 -1
  14. data/docs/providers/GEMINI.md +10 -0
  15. data/docs/providers/MOCK_PROVIDER.md +2 -0
  16. data/docs/providers/OPENAI.md +2 -0
  17. data/docs/providers/OPENROUTER.md +2 -0
  18. data/docs-site/manifest.yml +3 -0
  19. data/lib/riffer/agent/config.rb +17 -0
  20. data/lib/riffer/agent/run.rb +2 -0
  21. data/lib/riffer/agent/serializer.rb +2 -0
  22. data/lib/riffer/agent.rb +7 -0
  23. data/lib/riffer/{config/pricing → catalog}/rates.rb +21 -6
  24. data/lib/riffer/catalog.rb +225 -0
  25. data/lib/riffer/config/pricing.rb +17 -27
  26. data/lib/riffer/config.rb +29 -0
  27. data/lib/riffer/providers/amazon_bedrock.rb +14 -0
  28. data/lib/riffer/providers/anthropic.rb +8 -0
  29. data/lib/riffer/providers/base.rb +58 -6
  30. data/lib/riffer/providers/gemini.rb +6 -0
  31. data/lib/riffer/providers/mock.rb +7 -0
  32. data/lib/riffer/providers/open_ai.rb +6 -0
  33. data/lib/riffer/providers/open_router.rb +6 -0
  34. data/lib/riffer/version.rb +1 -1
  35. data/lib/riffer.rb +2 -0
  36. data/sig/generated/riffer/agent/config.rbs +10 -1
  37. data/sig/generated/riffer/agent.rbs +4 -0
  38. data/sig/generated/riffer/{config/pricing → catalog}/rates.rbs +10 -4
  39. data/sig/generated/riffer/catalog.rbs +77 -0
  40. data/sig/generated/riffer/config/pricing.rbs +12 -11
  41. data/sig/generated/riffer/config.rbs +17 -0
  42. data/sig/generated/riffer/providers/amazon_bedrock.rbs +6 -0
  43. data/sig/generated/riffer/providers/anthropic.rbs +4 -0
  44. data/sig/generated/riffer/providers/base.rbs +22 -2
  45. data/sig/generated/riffer/providers/gemini.rbs +4 -0
  46. data/sig/generated/riffer/providers/mock.rbs +5 -0
  47. data/sig/generated/riffer/providers/open_ai.rbs +4 -0
  48. data/sig/generated/riffer/providers/open_router.rbs +4 -0
  49. data/sig/generated/riffer.rbs +1 -0
  50. metadata +6 -3
@@ -1,6 +1,6 @@
1
- # Generated from lib/riffer/config/pricing/rates.rb with RBS::Inline
1
+ # Generated from lib/riffer/catalog/rates.rb with RBS::Inline
2
2
 
3
- class Riffer::Config::Pricing::Rates
3
+ class Riffer::Catalog::Rates
4
4
  attr_reader input: Float
5
5
 
6
6
  attr_reader output: Float
@@ -10,10 +10,16 @@ class Riffer::Config::Pricing::Rates
10
10
  attr_reader cache_write: Float?
11
11
 
12
12
  # --
13
- # : (input: Float, output: Float, ?cache_read: Float?, ?cache_write: Float?) -> void
14
- def initialize: (input: Float, output: Float, ?cache_read: Float?, ?cache_write: Float?) -> void
13
+ # : (input: untyped, output: untyped, ?cache_read: untyped, ?cache_write: untyped) -> void
14
+ def initialize: (input: untyped, output: untyped, ?cache_read: untyped, ?cache_write: untyped) -> void
15
15
 
16
16
  # --
17
17
  # : (input_tokens: Integer, output_tokens: Integer, ?cache_read_tokens: Integer?, ?cache_write_tokens: Integer?) -> Float
18
18
  def cost_for: (input_tokens: Integer, output_tokens: Integer, ?cache_read_tokens: Integer?, ?cache_write_tokens: Integer?) -> Float
19
+
20
+ private
21
+
22
+ # --
23
+ # : (untyped, String) -> Float
24
+ def coerce_rate: (untyped, String) -> Float
19
25
  end
@@ -0,0 +1,77 @@
1
+ # Generated from lib/riffer/catalog.rb with RBS::Inline
2
+
3
+ class Riffer::Catalog
4
+ SUPPORTED_VERSIONS: Array[Integer]
5
+
6
+ FILE_KEYS: Array[String]
7
+
8
+ ENTRY_KEYS: Array[String]
9
+
10
+ PRICING_KEYS: Array[String]
11
+
12
+ @aliases: Hash[String, String]
13
+
14
+ @models: Hash[String, Hash[Symbol, untyped]]
15
+
16
+ # --
17
+ # : (Array[String]) -> Riffer::Catalog
18
+ def self.load: (Array[String]) -> Riffer::Catalog
19
+
20
+ # --
21
+ # : (models: Hash[String, Hash[Symbol, untyped]], aliases: Hash[String, String]) -> void
22
+ def initialize: (models: Hash[String, Hash[Symbol, untyped]], aliases: Hash[String, String]) -> void
23
+
24
+ # --
25
+ # : (String, Symbol) -> Hash[Symbol, untyped]?
26
+ def reasoning_options: (String, Symbol) -> Hash[Symbol, untyped]?
27
+
28
+ # --
29
+ # : (String) -> Riffer::Catalog::Rates?
30
+ def rates_for: (String) -> Riffer::Catalog::Rates?
31
+
32
+ # --
33
+ # : () -> bool
34
+ def empty?: () -> bool
35
+
36
+ # --
37
+ # : (String) -> Hash[String, Hash[Symbol, untyped]]
38
+ def self.parse_file: (String) -> Hash[String, Hash[Symbol, untyped]]
39
+
40
+ # --
41
+ # : (String, String, untyped) -> Hash[Symbol, untyped]
42
+ def self.parse_entry: (String, String, untyped) -> Hash[Symbol, untyped]
43
+
44
+ # --
45
+ # : (String, String, untyped) -> Array[String]
46
+ def self.parse_aliases: (String, String, untyped) -> Array[String]
47
+
48
+ # --
49
+ # : (String, String, untyped) -> Riffer::Catalog::Rates
50
+ def self.parse_pricing: (String, String, untyped) -> Riffer::Catalog::Rates
51
+
52
+ # --
53
+ # : (String, String, untyped) -> Hash[Symbol, Hash[Symbol, untyped]]
54
+ def self.parse_reasoning: (String, String, untyped) -> Hash[Symbol, Hash[Symbol, untyped]]
55
+
56
+ # --
57
+ # : (String, untyped, String) -> void
58
+ def self.validate_model_key!: (String, untyped, String) -> void
59
+
60
+ # --
61
+ # : (untyped) -> untyped
62
+ def self.symbolize_keys: (untyped) -> untyped
63
+
64
+ # --
65
+ # : (String, String) -> bot
66
+ def self.fail_load!: (String, String) -> bot
67
+
68
+ private
69
+
70
+ # --
71
+ # : (String) -> Hash[Symbol, untyped]?
72
+ def entry: (String) -> Hash[Symbol, untyped]?
73
+
74
+ # --
75
+ # : (untyped) -> untyped
76
+ def deep_freeze: (untyped) -> untyped
77
+ end
@@ -1,7 +1,13 @@
1
1
  # Generated from lib/riffer/config/pricing.rb with RBS::Inline
2
2
 
3
+ # @deprecated Set pricing in a catalog file instead (see docs/CATALOG.md).
4
+ # A catalog entry's pricing wins over rates registered here.
3
5
  class Riffer::Config::Pricing
4
- @rates: Hash[String, Riffer::Config::Pricing::Rates]
6
+ DEPRECATION_MESSAGE: String
7
+
8
+ @rates: Hash[String, Riffer::Catalog::Rates]
9
+
10
+ self.@warned: bool
5
11
 
6
12
  # --
7
13
  # : () -> void
@@ -12,20 +18,15 @@ class Riffer::Config::Pricing
12
18
  def set: (String | Array[String], input: Numeric, output: Numeric, ?cache_read: Numeric?, ?cache_write: Numeric?) -> void
13
19
 
14
20
  # --
15
- # : (String) -> Riffer::Config::Pricing::Rates?
16
- def rates_for: (String) -> Riffer::Config::Pricing::Rates?
21
+ # : (String) -> Riffer::Catalog::Rates?
22
+ def rates_for: (String) -> Riffer::Catalog::Rates?
17
23
 
18
24
  # --
19
25
  # : () -> bool
20
26
  def empty?: () -> bool
21
27
 
22
- private
23
-
28
+ # Once per process, so a boot that sets many models logs one line.
24
29
  # --
25
- # : (untyped, String) -> Float
26
- def coerce_rate: (untyped, String) -> Float
27
-
28
- # --
29
- # : (untyped, String) -> Float?
30
- def coerce_optional_rate: (untyped, String) -> Float?
30
+ # : () -> void
31
+ def self.warn_deprecated: () -> void
31
32
  end
@@ -3,6 +3,8 @@
3
3
  class Riffer::Config
4
4
  VALID_MESSAGE_ID_STRATEGIES: untyped
5
5
 
6
+ @catalog: Riffer::Catalog?
7
+
6
8
  attr_reader amazon_bedrock: Riffer::Config::AmazonBedrock
7
9
 
8
10
  attr_reader anthropic: Riffer::Config::Anthropic
@@ -31,8 +33,23 @@ class Riffer::Config
31
33
 
32
34
  attr_reader files: Riffer::Config::Files
33
35
 
36
+ # @deprecated Use +catalog_files+.
34
37
  attr_reader pricing: Riffer::Config::Pricing
35
38
 
39
+ attr_reader catalog_files: Array[String]
40
+
41
+ # --
42
+ # : (Array[untyped]) -> void
43
+ def catalog_files=: (Array[untyped]) -> void
44
+
45
+ # --
46
+ # : () -> Riffer::Catalog
47
+ def catalog: () -> Riffer::Catalog
48
+
49
+ # --
50
+ # : () -> Riffer::Catalog
51
+ def reload_catalog: () -> Riffer::Catalog
52
+
36
53
  # When not +:none+, seeded messages passed to +Riffer::Agent#generate+ must
37
54
  # carry their own +id+.
38
55
  attr_reader message_id_strategy: Symbol
@@ -36,6 +36,12 @@ class Riffer::Providers::AmazonBedrock < Riffer::Providers::Base
36
36
  # : () -> untyped
37
37
  def build_client: () -> untyped
38
38
 
39
+ # Claude's fields, since application inference profile ARNs hide the model
40
+ # family; other families need a catalog entry.
41
+ # --
42
+ # : (Symbol) -> Hash[Symbol, untyped]
43
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]
44
+
39
45
  # --
40
46
  # : (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
41
47
  def build_request_params: (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -32,6 +32,10 @@ class Riffer::Providers::Anthropic < Riffer::Providers::Base
32
32
  # : () -> untyped
33
33
  def build_client: () -> untyped
34
34
 
35
+ # --
36
+ # : (Symbol) -> Hash[Symbol, untyped]
37
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]
38
+
35
39
  # --
36
40
  # : (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
37
41
  def build_request_params: (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -76,8 +76,28 @@ class Riffer::Providers::Base
76
76
  def apply_pricing: (Riffer::Providers::TokenUsage) -> Riffer::Providers::TokenUsage
77
77
 
78
78
  # --
79
- # : () -> Riffer::Config::Pricing::Rates?
80
- def pricing_rates: () -> Riffer::Config::Pricing::Rates?
79
+ # : () -> Riffer::Catalog::Rates?
80
+ def pricing_rates: () -> Riffer::Catalog::Rates?
81
+
82
+ # --
83
+ # : (String) -> String?
84
+ def catalog_key: (String) -> String?
85
+
86
+ # A catalog fragment beats the provider default per level; the caller's
87
+ # options are merged over either, so +model_options+ always wins.
88
+ # --
89
+ # : (String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
90
+ def apply_reasoning: (String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
91
+
92
+ # Maps a level onto the provider's own reasoning params when the catalog has
93
+ # no entry; +nil+ means riffer raises before the request.
94
+ # --
95
+ # : (Symbol) -> Hash[Symbol, untyped]?
96
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]?
97
+
98
+ # --
99
+ # : (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
100
+ def deep_merge: (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
81
101
 
82
102
  # --
83
103
  # : (untyped) -> Riffer::Providers::FinishReason?
@@ -23,6 +23,10 @@ class Riffer::Providers::Gemini < Riffer::Providers::Base
23
23
  # : () -> untyped
24
24
  def build_client: () -> untyped
25
25
 
26
+ # --
27
+ # : (Symbol) -> Hash[Symbol, untyped]
28
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]
29
+
26
30
  # --
27
31
  # : (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
28
32
  def build_request_params: (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -35,6 +35,11 @@ class Riffer::Providers::Mock < Riffer::Providers::Base
35
35
  # : (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
36
36
  def normalize_response: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
37
37
 
38
+ # Never raises, so test suites can set +reasoning+ without catalog entries.
39
+ # --
40
+ # : (Symbol) -> Hash[Symbol, untyped]
41
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]
42
+
38
43
  # --
39
44
  # : (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
40
45
  def build_request_params: (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -29,6 +29,10 @@ class Riffer::Providers::OpenAI < Riffer::Providers::Base
29
29
  # : () -> untyped
30
30
  def build_client: () -> untyped
31
31
 
32
+ # --
33
+ # : (Symbol) -> Hash[Symbol, untyped]
34
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]
35
+
32
36
  # --
33
37
  # : (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
34
38
  def build_request_params: (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -34,6 +34,10 @@ class Riffer::Providers::OpenRouter < Riffer::Providers::Base
34
34
  # : () -> untyped
35
35
  def build_client: () -> untyped
36
36
 
37
+ # --
38
+ # : (Symbol) -> Hash[Symbol, untyped]
39
+ def default_reasoning_options: (Symbol) -> Hash[Symbol, untyped]
40
+
37
41
  # --
38
42
  # : (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
39
43
  def build_request_params: (Array[Riffer::Messages::Base], String?, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -55,6 +55,7 @@ module Riffer
55
55
  # : () -> Riffer::Config
56
56
  def config: () -> Riffer::Config
57
57
 
58
+ # Builds the catalog after the block, so a bad catalog file fails boot.
58
59
  # --
59
60
  # : () ?{ (Riffer::Config) -> void } -> void
60
61
  def configure: () ?{ (Riffer::Config) -> void } -> void
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riffer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.1
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bottrall
@@ -83,6 +83,7 @@ files:
83
83
  - docs/AGENTS.md
84
84
  - docs/AGENT_LIFECYCLE.md
85
85
  - docs/AGENT_LOOP.md
86
+ - docs/CATALOG.md
86
87
  - docs/CONFIGURATION.md
87
88
  - docs/EVALS.md
88
89
  - docs/GETTING_STARTED.md
@@ -119,6 +120,8 @@ files:
119
120
  - lib/riffer/agent/structured_output.rb
120
121
  - lib/riffer/agent/structured_output/parser.rb
121
122
  - lib/riffer/agent/structured_output/result.rb
123
+ - lib/riffer/catalog.rb
124
+ - lib/riffer/catalog/rates.rb
122
125
  - lib/riffer/config.rb
123
126
  - lib/riffer/config/amazon_bedrock.rb
124
127
  - lib/riffer/config/anthropic.rb
@@ -130,7 +133,6 @@ files:
130
133
  - lib/riffer/config/open_ai.rb
131
134
  - lib/riffer/config/open_router.rb
132
135
  - lib/riffer/config/pricing.rb
133
- - lib/riffer/config/pricing/rates.rb
134
136
  - lib/riffer/config/skills.rb
135
137
  - lib/riffer/config/tracing.rb
136
138
  - lib/riffer/evals.rb
@@ -268,6 +270,8 @@ files:
268
270
  - sig/generated/riffer/agent/structured_output.rbs
269
271
  - sig/generated/riffer/agent/structured_output/parser.rbs
270
272
  - sig/generated/riffer/agent/structured_output/result.rbs
273
+ - sig/generated/riffer/catalog.rbs
274
+ - sig/generated/riffer/catalog/rates.rbs
271
275
  - sig/generated/riffer/config.rbs
272
276
  - sig/generated/riffer/config/amazon_bedrock.rbs
273
277
  - sig/generated/riffer/config/anthropic.rbs
@@ -279,7 +283,6 @@ files:
279
283
  - sig/generated/riffer/config/open_ai.rbs
280
284
  - sig/generated/riffer/config/open_router.rbs
281
285
  - sig/generated/riffer/config/pricing.rbs
282
- - sig/generated/riffer/config/pricing/rates.rbs
283
286
  - sig/generated/riffer/config/skills.rbs
284
287
  - sig/generated/riffer/config/tracing.rbs
285
288
  - sig/generated/riffer/evals.rbs