ruby_llm 1.1.0 → 1.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: b157007e50a6d43f11591847306e9e950904ad71dde849dded2f4364f376fa0f
4
- data.tar.gz: 9f2024f254134590b971a98b6fe1cae161bfd25378f747cd6c192237add0d80c
3
+ metadata.gz: d3226fdaf84de31b1deefae4aa85ca721d4fc6ce2a84572d211a57a0acbf1cb3
4
+ data.tar.gz: 8846beaefacc53539987eaf6b619e4833267a928f688ad6afc4277180eaac7b2
5
5
  SHA512:
6
- metadata.gz: d804afb295a9b9d174f44ac110ce60e9d6b3ab6a4e96d003532bbdf5c95bc6db34b7affcec44d6025eff98d71a38a356417dee3912776b44feb735b803c49ed6
7
- data.tar.gz: ef562bad49590fc86fb78311f861688175a55b9ab2b6d68c23d74cbaeabc1ecf9703b420bed5f8bc689fb1542cbe2fe484b1aa52e8df53d8b6fedb6737b19f18
6
+ metadata.gz: 1556e816f7ffdb9323b53067f6faefc9c96eb0e116740b690dfa96afdc39c96d0b294efe4b8a363279bf6d43c907d4e6ebdf92cde0dc996218961627a655a626
7
+ data.tar.gz: 75def96179be6d1d44cce576a698aaeb7bf5cf11ac60d0699f12de7d7dfa32f9a71906821ec43d1f77b98fd152156af41d10b89e832406601f42239872950a8c
@@ -25,13 +25,13 @@ module RubyLLM
25
25
  to: :to_llm
26
26
  end
27
27
 
28
- def acts_as_message(chat_class: 'Chat', tool_call_class: 'ToolCall') # rubocop:disable Metrics/MethodLength
28
+ def acts_as_message(chat_class: 'Chat', tool_call_class: 'ToolCall', touch_chat: false) # rubocop:disable Metrics/MethodLength
29
29
  include MessageMethods
30
30
 
31
31
  @chat_class = chat_class.to_s
32
32
  @tool_call_class = tool_call_class.to_s
33
33
 
34
- belongs_to :chat, class_name: @chat_class
34
+ belongs_to :chat, class_name: @chat_class, touch: touch_chat
35
35
  has_many :tool_calls, class_name: @tool_call_class, dependent: :destroy
36
36
 
37
37
  belongs_to :parent_tool_call,
@@ -34,32 +34,5 @@
34
34
  "claude-2-1": {
35
35
  "anthropic": "claude-2.1",
36
36
  "bedrock": "anthropic.claude-2.1"
37
- },
38
- "gpt-4o": {
39
- "openai": "gpt-4o-2024-11-20"
40
- },
41
- "gpt-4o-mini": {
42
- "openai": "gpt-4o-mini-2024-07-18"
43
- },
44
- "gpt-4-turbo": {
45
- "openai": "gpt-4-turbo-2024-04-09"
46
- },
47
- "gemini-1.5-flash": {
48
- "gemini": "gemini-1.5-flash-002"
49
- },
50
- "gemini-1.5-flash-8b": {
51
- "gemini": "gemini-1.5-flash-8b-001"
52
- },
53
- "gemini-1.5-pro": {
54
- "gemini": "gemini-1.5-pro-002"
55
- },
56
- "gemini-2.0-flash": {
57
- "gemini": "gemini-2.0-flash-001"
58
- },
59
- "o1": {
60
- "openai": "o1-2024-12-17"
61
- },
62
- "o3-mini": {
63
- "openai": "o3-mini-2025-01-31"
64
37
  }
65
38
  }
@@ -4,7 +4,7 @@
4
4
  "created_at": null,
5
5
  "display_name": "Claude 3.5 Haiku",
6
6
  "provider": "bedrock",
7
- "context_window": 4096,
7
+ "context_window": 200000,
8
8
  "max_tokens": 4096,
9
9
  "type": "chat",
10
10
  "family": "claude3_5_haiku",
@@ -34,7 +34,7 @@
34
34
  "created_at": null,
35
35
  "display_name": "Claude 3.5 Sonnet",
36
36
  "provider": "bedrock",
37
- "context_window": 4096,
37
+ "context_window": 200000,
38
38
  "max_tokens": 4096,
39
39
  "type": "chat",
40
40
  "family": "claude3_sonnet",
@@ -47,7 +47,8 @@
47
47
  "provider_name": "Anthropic",
48
48
  "customizations_supported": [],
49
49
  "inference_configurations": [
50
- "ON_DEMAND"
50
+ "ON_DEMAND",
51
+ "INFERENCE_PROFILE"
51
52
  ],
52
53
  "response_streaming_supported": true,
53
54
  "input_modalities": [
@@ -64,7 +65,7 @@
64
65
  "created_at": null,
65
66
  "display_name": "Claude 3.5 Sonnet",
66
67
  "provider": "bedrock",
67
- "context_window": 4096,
68
+ "context_window": 200000,
68
69
  "max_tokens": 4096,
69
70
  "type": "chat",
70
71
  "family": "claude3_sonnet",
@@ -94,7 +95,7 @@
94
95
  "created_at": null,
95
96
  "display_name": "Claude 3.5 Sonnet",
96
97
  "provider": "bedrock",
97
- "context_window": 4096,
98
+ "context_window": 200000,
98
99
  "max_tokens": 4096,
99
100
  "type": "chat",
100
101
  "family": "claude3_sonnet",
@@ -124,7 +125,7 @@
124
125
  "created_at": null,
125
126
  "display_name": "Claude 3.5 Sonnet",
126
127
  "provider": "bedrock",
127
- "context_window": 4096,
128
+ "context_window": 200000,
128
129
  "max_tokens": 4096,
129
130
  "type": "chat",
130
131
  "family": "claude3_sonnet",
@@ -154,7 +155,7 @@
154
155
  "created_at": null,
155
156
  "display_name": "Claude 3.5 Sonnet v2",
156
157
  "provider": "bedrock",
157
- "context_window": 4096,
158
+ "context_window": 200000,
158
159
  "max_tokens": 4096,
159
160
  "type": "chat",
160
161
  "family": "claude3_sonnet",
@@ -184,7 +185,7 @@
184
185
  "created_at": null,
185
186
  "display_name": "Claude 3.5 Sonnet v2",
186
187
  "provider": "bedrock",
187
- "context_window": 4096,
188
+ "context_window": 200000,
188
189
  "max_tokens": 4096,
189
190
  "type": "chat",
190
191
  "family": "claude3_sonnet",
@@ -214,7 +215,7 @@
214
215
  "created_at": null,
215
216
  "display_name": "Claude 3.5 Sonnet v2",
216
217
  "provider": "bedrock",
217
- "context_window": 4096,
218
+ "context_window": 200000,
218
219
  "max_tokens": 4096,
219
220
  "type": "chat",
220
221
  "family": "claude3_sonnet",
@@ -244,7 +245,7 @@
244
245
  "created_at": null,
245
246
  "display_name": "Claude 3.5 Sonnet v2",
246
247
  "provider": "bedrock",
247
- "context_window": 4096,
248
+ "context_window": 200000,
248
249
  "max_tokens": 4096,
249
250
  "type": "chat",
250
251
  "family": "claude3_sonnet",
@@ -270,11 +271,11 @@
270
271
  }
271
272
  },
272
273
  {
273
- "id": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
274
+ "id": "anthropic.claude-3-7-sonnet-20250219-v1:0",
274
275
  "created_at": null,
275
276
  "display_name": "Claude 3.7 Sonnet",
276
277
  "provider": "bedrock",
277
- "context_window": 4096,
278
+ "context_window": 200000,
278
279
  "max_tokens": 4096,
279
280
  "type": "chat",
280
281
  "family": "claude3_sonnet",
@@ -607,13 +608,13 @@
607
608
  "created_at": null,
608
609
  "display_name": "Claude Instant",
609
610
  "provider": "bedrock",
610
- "context_window": 4096,
611
+ "context_window": 200000,
611
612
  "max_tokens": 4096,
612
613
  "type": "chat",
613
614
  "family": "claude_instant",
614
- "supports_vision": false,
615
- "supports_functions": false,
616
- "supports_json_mode": false,
615
+ "supports_vision": true,
616
+ "supports_functions": true,
617
+ "supports_json_mode": true,
617
618
  "input_price_per_million": 0.8,
618
619
  "output_price_per_million": 2.4,
619
620
  "metadata": {
@@ -636,13 +637,13 @@
636
637
  "created_at": null,
637
638
  "display_name": "Claude Instant",
638
639
  "provider": "bedrock",
639
- "context_window": 4096,
640
+ "context_window": 200000,
640
641
  "max_tokens": 4096,
641
642
  "type": "chat",
642
643
  "family": "claude_instant",
643
- "supports_vision": false,
644
- "supports_functions": false,
645
- "supports_json_mode": false,
644
+ "supports_vision": true,
645
+ "supports_functions": true,
646
+ "supports_json_mode": true,
646
647
  "input_price_per_million": 0.8,
647
648
  "output_price_per_million": 2.4,
648
649
  "metadata": {
@@ -665,13 +666,13 @@
665
666
  "created_at": null,
666
667
  "display_name": "Claude",
667
668
  "provider": "bedrock",
668
- "context_window": 4096,
669
+ "context_window": 200000,
669
670
  "max_tokens": 4096,
670
671
  "type": "chat",
671
672
  "family": "claude2",
672
- "supports_vision": false,
673
- "supports_functions": false,
674
- "supports_json_mode": false,
673
+ "supports_vision": true,
674
+ "supports_functions": true,
675
+ "supports_json_mode": true,
675
676
  "input_price_per_million": 8.0,
676
677
  "output_price_per_million": 24.0,
677
678
  "metadata": {
@@ -694,13 +695,13 @@
694
695
  "created_at": null,
695
696
  "display_name": "Claude",
696
697
  "provider": "bedrock",
697
- "context_window": 4096,
698
+ "context_window": 200000,
698
699
  "max_tokens": 4096,
699
700
  "type": "chat",
700
701
  "family": "claude2",
701
- "supports_vision": false,
702
- "supports_functions": false,
703
- "supports_json_mode": false,
702
+ "supports_vision": true,
703
+ "supports_functions": true,
704
+ "supports_json_mode": true,
704
705
  "input_price_per_million": 8.0,
705
706
  "output_price_per_million": 24.0,
706
707
  "metadata": {
@@ -723,13 +724,13 @@
723
724
  "created_at": null,
724
725
  "display_name": "Claude",
725
726
  "provider": "bedrock",
726
- "context_window": 4096,
727
+ "context_window": 200000,
727
728
  "max_tokens": 4096,
728
729
  "type": "chat",
729
730
  "family": "claude2",
730
- "supports_vision": false,
731
- "supports_functions": false,
732
- "supports_json_mode": false,
731
+ "supports_vision": true,
732
+ "supports_functions": true,
733
+ "supports_json_mode": true,
733
734
  "input_price_per_million": 8.0,
734
735
  "output_price_per_million": 24.0,
735
736
  "metadata": {
@@ -752,13 +753,13 @@
752
753
  "created_at": null,
753
754
  "display_name": "Claude",
754
755
  "provider": "bedrock",
755
- "context_window": 4096,
756
+ "context_window": 200000,
756
757
  "max_tokens": 4096,
757
758
  "type": "chat",
758
759
  "family": "claude2",
759
- "supports_vision": false,
760
- "supports_functions": false,
761
- "supports_json_mode": false,
760
+ "supports_vision": true,
761
+ "supports_functions": true,
762
+ "supports_json_mode": true,
762
763
  "input_price_per_million": 8.0,
763
764
  "output_price_per_million": 24.0,
764
765
  "metadata": {
@@ -781,13 +782,13 @@
781
782
  "created_at": null,
782
783
  "display_name": "Claude",
783
784
  "provider": "bedrock",
784
- "context_window": 4096,
785
+ "context_window": 200000,
785
786
  "max_tokens": 4096,
786
787
  "type": "chat",
787
788
  "family": "claude2",
788
- "supports_vision": false,
789
- "supports_functions": false,
790
- "supports_json_mode": false,
789
+ "supports_vision": true,
790
+ "supports_functions": true,
791
+ "supports_json_mode": true,
791
792
  "input_price_per_million": 8.0,
792
793
  "output_price_per_million": 24.0,
793
794
  "metadata": {
@@ -810,13 +811,13 @@
810
811
  "created_at": null,
811
812
  "display_name": "Claude",
812
813
  "provider": "bedrock",
813
- "context_window": 4096,
814
+ "context_window": 200000,
814
815
  "max_tokens": 4096,
815
816
  "type": "chat",
816
817
  "family": "claude2",
817
- "supports_vision": false,
818
- "supports_functions": false,
819
- "supports_json_mode": false,
818
+ "supports_vision": true,
819
+ "supports_functions": true,
820
+ "supports_json_mode": true,
820
821
  "input_price_per_million": 8.0,
821
822
  "output_price_per_million": 24.0,
822
823
  "metadata": {
@@ -1613,7 +1614,8 @@
1613
1614
  "output_token_limit": 8192,
1614
1615
  "supported_generation_methods": [
1615
1616
  "generateContent",
1616
- "countTokens"
1617
+ "countTokens",
1618
+ "createCachedContent"
1617
1619
  ]
1618
1620
  }
1619
1621
  },
@@ -1638,7 +1640,8 @@
1638
1640
  "output_token_limit": 8192,
1639
1641
  "supported_generation_methods": [
1640
1642
  "generateContent",
1641
- "countTokens"
1643
+ "countTokens",
1644
+ "createCachedContent"
1642
1645
  ]
1643
1646
  }
1644
1647
  },
@@ -1794,6 +1797,31 @@
1794
1797
  ]
1795
1798
  }
1796
1799
  },
1800
+ {
1801
+ "id": "gemini-2.0-flash-live-001",
1802
+ "created_at": null,
1803
+ "display_name": "Gemini 2.0 Flash 001",
1804
+ "provider": "gemini",
1805
+ "context_window": 131072,
1806
+ "max_tokens": 8192,
1807
+ "type": "chat",
1808
+ "family": "gemini20_flash",
1809
+ "supports_vision": true,
1810
+ "supports_functions": true,
1811
+ "supports_json_mode": true,
1812
+ "input_price_per_million": 0.1,
1813
+ "output_price_per_million": 0.4,
1814
+ "metadata": {
1815
+ "version": "001",
1816
+ "description": "Gemini 2.0 Flash 001",
1817
+ "input_token_limit": 131072,
1818
+ "output_token_limit": 8192,
1819
+ "supported_generation_methods": [
1820
+ "bidiGenerateContent",
1821
+ "countTokens"
1822
+ ]
1823
+ }
1824
+ },
1797
1825
  {
1798
1826
  "id": "gemini-2.0-flash-thinking-exp",
1799
1827
  "created_at": null,
@@ -1944,6 +1972,31 @@
1944
1972
  ]
1945
1973
  }
1946
1974
  },
1975
+ {
1976
+ "id": "gemini-2.5-pro-preview-03-25",
1977
+ "created_at": null,
1978
+ "display_name": "Gemini 2.5 Pro Preview 03-25",
1979
+ "provider": "gemini",
1980
+ "context_window": 1048576,
1981
+ "max_tokens": 65536,
1982
+ "type": "chat",
1983
+ "family": "other",
1984
+ "supports_vision": true,
1985
+ "supports_functions": true,
1986
+ "supports_json_mode": true,
1987
+ "input_price_per_million": 0.075,
1988
+ "output_price_per_million": 0.3,
1989
+ "metadata": {
1990
+ "version": "2.5-preview-03-25",
1991
+ "description": "Gemini 2.5 Pro Preview 03-25",
1992
+ "input_token_limit": 1048576,
1993
+ "output_token_limit": 65536,
1994
+ "supported_generation_methods": [
1995
+ "generateContent",
1996
+ "countTokens"
1997
+ ]
1998
+ }
1999
+ },
1947
2000
  {
1948
2001
  "id": "gemini-embedding-exp",
1949
2002
  "created_at": null,
@@ -1964,7 +2017,8 @@
1964
2017
  "input_token_limit": 8192,
1965
2018
  "output_token_limit": 1,
1966
2019
  "supported_generation_methods": [
1967
- "embedContent"
2020
+ "embedContent",
2021
+ "countTextTokens"
1968
2022
  ]
1969
2023
  }
1970
2024
  },
@@ -1988,7 +2042,8 @@
1988
2042
  "input_token_limit": 8192,
1989
2043
  "output_token_limit": 1,
1990
2044
  "supported_generation_methods": [
1991
- "embedContent"
2045
+ "embedContent",
2046
+ "countTextTokens"
1992
2047
  ]
1993
2048
  }
1994
2049
  },
@@ -2042,6 +2097,56 @@
2042
2097
  ]
2043
2098
  }
2044
2099
  },
2100
+ {
2101
+ "id": "gemma-3-12b-it",
2102
+ "created_at": null,
2103
+ "display_name": "Gemma 3 12B",
2104
+ "provider": "gemini",
2105
+ "context_window": 32768,
2106
+ "max_tokens": 8192,
2107
+ "type": "chat",
2108
+ "family": "other",
2109
+ "supports_vision": false,
2110
+ "supports_functions": false,
2111
+ "supports_json_mode": false,
2112
+ "input_price_per_million": 0.075,
2113
+ "output_price_per_million": 0.3,
2114
+ "metadata": {
2115
+ "version": "001",
2116
+ "description": null,
2117
+ "input_token_limit": 32768,
2118
+ "output_token_limit": 8192,
2119
+ "supported_generation_methods": [
2120
+ "generateContent",
2121
+ "countTokens"
2122
+ ]
2123
+ }
2124
+ },
2125
+ {
2126
+ "id": "gemma-3-1b-it",
2127
+ "created_at": null,
2128
+ "display_name": "Gemma 3 1B",
2129
+ "provider": "gemini",
2130
+ "context_window": 32768,
2131
+ "max_tokens": 8192,
2132
+ "type": "chat",
2133
+ "family": "other",
2134
+ "supports_vision": false,
2135
+ "supports_functions": false,
2136
+ "supports_json_mode": false,
2137
+ "input_price_per_million": 0.075,
2138
+ "output_price_per_million": 0.3,
2139
+ "metadata": {
2140
+ "version": "001",
2141
+ "description": null,
2142
+ "input_token_limit": 32768,
2143
+ "output_token_limit": 8192,
2144
+ "supported_generation_methods": [
2145
+ "generateContent",
2146
+ "countTokens"
2147
+ ]
2148
+ }
2149
+ },
2045
2150
  {
2046
2151
  "id": "gemma-3-27b-it",
2047
2152
  "created_at": null,
@@ -2067,6 +2172,31 @@
2067
2172
  ]
2068
2173
  }
2069
2174
  },
2175
+ {
2176
+ "id": "gemma-3-4b-it",
2177
+ "created_at": null,
2178
+ "display_name": "Gemma 3 4B",
2179
+ "provider": "gemini",
2180
+ "context_window": 32768,
2181
+ "max_tokens": 8192,
2182
+ "type": "chat",
2183
+ "family": "other",
2184
+ "supports_vision": false,
2185
+ "supports_functions": false,
2186
+ "supports_json_mode": false,
2187
+ "input_price_per_million": 0.075,
2188
+ "output_price_per_million": 0.3,
2189
+ "metadata": {
2190
+ "version": "001",
2191
+ "description": null,
2192
+ "input_token_limit": 32768,
2193
+ "output_token_limit": 8192,
2194
+ "supported_generation_methods": [
2195
+ "generateContent",
2196
+ "countTokens"
2197
+ ]
2198
+ }
2199
+ },
2070
2200
  {
2071
2201
  "id": "gpt-3.5-turbo",
2072
2202
  "created_at": "2023-02-28T19:56:42+01:00",
@@ -2314,6 +2444,120 @@
2314
2444
  "owned_by": "system"
2315
2445
  }
2316
2446
  },
2447
+ {
2448
+ "id": "gpt-4.1",
2449
+ "created_at": "2025-04-10T22:22:22+02:00",
2450
+ "display_name": "GPT-4.1",
2451
+ "provider": "openai",
2452
+ "context_window": 1047576,
2453
+ "max_tokens": 32768,
2454
+ "type": "chat",
2455
+ "family": "gpt41",
2456
+ "supports_vision": true,
2457
+ "supports_functions": true,
2458
+ "supports_json_mode": true,
2459
+ "input_price_per_million": 2.0,
2460
+ "output_price_per_million": 8.0,
2461
+ "metadata": {
2462
+ "object": "model",
2463
+ "owned_by": "system"
2464
+ }
2465
+ },
2466
+ {
2467
+ "id": "gpt-4.1-2025-04-14",
2468
+ "created_at": "2025-04-10T22:09:06+02:00",
2469
+ "display_name": "GPT-4.1 20250414",
2470
+ "provider": "openai",
2471
+ "context_window": 1047576,
2472
+ "max_tokens": 32768,
2473
+ "type": "chat",
2474
+ "family": "gpt41",
2475
+ "supports_vision": true,
2476
+ "supports_functions": true,
2477
+ "supports_json_mode": true,
2478
+ "input_price_per_million": 2.0,
2479
+ "output_price_per_million": 8.0,
2480
+ "metadata": {
2481
+ "object": "model",
2482
+ "owned_by": "system"
2483
+ }
2484
+ },
2485
+ {
2486
+ "id": "gpt-4.1-mini",
2487
+ "created_at": "2025-04-10T22:49:33+02:00",
2488
+ "display_name": "GPT-4.1 Mini",
2489
+ "provider": "openai",
2490
+ "context_window": 1047576,
2491
+ "max_tokens": 32768,
2492
+ "type": "chat",
2493
+ "family": "gpt41_mini",
2494
+ "supports_vision": true,
2495
+ "supports_functions": true,
2496
+ "supports_json_mode": true,
2497
+ "input_price_per_million": 0.4,
2498
+ "output_price_per_million": 1.6,
2499
+ "metadata": {
2500
+ "object": "model",
2501
+ "owned_by": "system"
2502
+ }
2503
+ },
2504
+ {
2505
+ "id": "gpt-4.1-mini-2025-04-14",
2506
+ "created_at": "2025-04-10T22:39:07+02:00",
2507
+ "display_name": "GPT-4.1 Mini 20250414",
2508
+ "provider": "openai",
2509
+ "context_window": 1047576,
2510
+ "max_tokens": 32768,
2511
+ "type": "chat",
2512
+ "family": "gpt41_mini",
2513
+ "supports_vision": true,
2514
+ "supports_functions": true,
2515
+ "supports_json_mode": true,
2516
+ "input_price_per_million": 0.4,
2517
+ "output_price_per_million": 1.6,
2518
+ "metadata": {
2519
+ "object": "model",
2520
+ "owned_by": "system"
2521
+ }
2522
+ },
2523
+ {
2524
+ "id": "gpt-4.1-nano",
2525
+ "created_at": "2025-04-10T23:48:27+02:00",
2526
+ "display_name": "GPT-4.1 Nano",
2527
+ "provider": "openai",
2528
+ "context_window": 1047576,
2529
+ "max_tokens": 32768,
2530
+ "type": "chat",
2531
+ "family": "gpt41_nano",
2532
+ "supports_vision": true,
2533
+ "supports_functions": true,
2534
+ "supports_json_mode": true,
2535
+ "input_price_per_million": 0.1,
2536
+ "output_price_per_million": 0.4,
2537
+ "metadata": {
2538
+ "object": "model",
2539
+ "owned_by": "system"
2540
+ }
2541
+ },
2542
+ {
2543
+ "id": "gpt-4.1-nano-2025-04-14",
2544
+ "created_at": "2025-04-10T23:37:05+02:00",
2545
+ "display_name": "GPT-4.1 Nano 20250414",
2546
+ "provider": "openai",
2547
+ "context_window": 1047576,
2548
+ "max_tokens": 32768,
2549
+ "type": "chat",
2550
+ "family": "gpt41_nano",
2551
+ "supports_vision": true,
2552
+ "supports_functions": true,
2553
+ "supports_json_mode": true,
2554
+ "input_price_per_million": 0.1,
2555
+ "output_price_per_million": 0.4,
2556
+ "metadata": {
2557
+ "object": "model",
2558
+ "owned_by": "system"
2559
+ }
2560
+ },
2317
2561
  {
2318
2562
  "id": "gpt-4.5-preview",
2319
2563
  "created_at": "2025-02-27T03:24:19+01:00",
@@ -3249,6 +3493,30 @@
3249
3493
  "owned_by": "system"
3250
3494
  }
3251
3495
  },
3496
+ {
3497
+ "id": "veo-2.0-generate-001",
3498
+ "created_at": null,
3499
+ "display_name": "Veo 2",
3500
+ "provider": "gemini",
3501
+ "context_window": 480,
3502
+ "max_tokens": 8192,
3503
+ "type": "chat",
3504
+ "family": "other",
3505
+ "supports_vision": false,
3506
+ "supports_functions": false,
3507
+ "supports_json_mode": false,
3508
+ "input_price_per_million": 0.075,
3509
+ "output_price_per_million": 0.3,
3510
+ "metadata": {
3511
+ "version": "2.0",
3512
+ "description": "Vertex served Veo 2 model.",
3513
+ "input_token_limit": 480,
3514
+ "output_token_limit": 8192,
3515
+ "supported_generation_methods": [
3516
+ "predictLongRunning"
3517
+ ]
3518
+ }
3519
+ },
3252
3520
  {
3253
3521
  "id": "whisper-1",
3254
3522
  "created_at": "2023-02-27T22:13:04+01:00",
@@ -3,13 +3,15 @@
3
3
  module RubyLLM
4
4
  module Providers
5
5
  module OpenAI
6
- # Determines capabilities and pricing for OpenAI models
7
- module Capabilities # rubocop:disable Metrics/ModuleLength
6
+ module Capabilities # rubocop:disable Metrics/ModuleLength,Style/Documentation
8
7
  module_function
9
8
 
10
9
  MODEL_PATTERNS = {
11
10
  dall_e: /^dall-e/,
12
11
  chatgpt4o: /^chatgpt-4o/,
12
+ gpt41: /^gpt-4\.1(?!-(?:mini|nano))/,
13
+ gpt41_mini: /^gpt-4\.1-mini/,
14
+ gpt41_nano: /^gpt-4\.1-nano/,
13
15
  gpt4: /^gpt-4(?:-\d{6})?$/,
14
16
  gpt4_turbo: /^gpt-4(?:\.5)?-(?:\d{6}-)?(preview|turbo)/,
15
17
  gpt35_turbo: /^gpt-3\.5-turbo/,
@@ -38,8 +40,9 @@ module RubyLLM
38
40
  moderation: /^(?:omni|text)-moderation/
39
41
  }.freeze
40
42
 
41
- def context_window_for(model_id) # rubocop:disable Metrics/MethodLength
43
+ def context_window_for(model_id) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength
42
44
  case model_family(model_id)
45
+ when 'gpt41', 'gpt41_mini', 'gpt41_nano' then 1_047_576
43
46
  when 'chatgpt4o', 'gpt4_turbo', 'gpt4o', 'gpt4o_audio', 'gpt4o_mini',
44
47
  'gpt4o_mini_audio', 'gpt4o_mini_realtime', 'gpt4o_realtime',
45
48
  'gpt4o_search', 'gpt4o_transcribe', 'gpt4o_mini_search', 'o1_mini' then 128_000
@@ -55,6 +58,7 @@ module RubyLLM
55
58
 
56
59
  def max_tokens_for(model_id) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength
57
60
  case model_family(model_id)
61
+ when 'gpt41', 'gpt41_mini', 'gpt41_nano' then 32_768
58
62
  when 'chatgpt4o', 'gpt4o', 'gpt4o_mini', 'gpt4o_mini_search' then 16_384
59
63
  when 'babbage', 'davinci' then 16_384 # rubocop:disable Lint/DuplicateBranch
60
64
  when 'gpt4' then 8_192
@@ -71,15 +75,16 @@ module RubyLLM
71
75
 
72
76
  def supports_vision?(model_id)
73
77
  case model_family(model_id)
74
- when 'chatgpt4o', 'gpt4', 'gpt4_turbo', 'gpt4o', 'gpt4o_mini', 'o1', 'o1_pro',
75
- 'moderation', 'gpt4o_search', 'gpt4o_mini_search' then true
78
+ when 'gpt41', 'gpt41_mini', 'gpt41_nano', 'chatgpt4o', 'gpt4', 'gpt4_turbo', 'gpt4o', 'gpt4o_mini', 'o1',
79
+ 'o1_pro', 'moderation', 'gpt4o_search', 'gpt4o_mini_search' then true
76
80
  else false
77
81
  end
78
82
  end
79
83
 
80
84
  def supports_functions?(model_id)
81
85
  case model_family(model_id)
82
- when 'gpt4', 'gpt4_turbo', 'gpt4o', 'gpt4o_mini', 'o1', 'o1_pro', 'o3_mini' then true
86
+ when 'gpt41', 'gpt41_mini', 'gpt41_nano', 'gpt4', 'gpt4_turbo', 'gpt4o', 'gpt4o_mini', 'o1', 'o1_pro',
87
+ 'o3_mini' then true
83
88
  when 'chatgpt4o', 'gpt35_turbo', 'o1_mini', 'gpt4o_mini_tts',
84
89
  'gpt4o_transcribe', 'gpt4o_search', 'gpt4o_mini_search' then false
85
90
  else false # rubocop:disable Lint/DuplicateBranch
@@ -88,7 +93,8 @@ module RubyLLM
88
93
 
89
94
  def supports_structured_output?(model_id)
90
95
  case model_family(model_id)
91
- when 'chatgpt4o', 'gpt4o', 'gpt4o_mini', 'o1', 'o1_pro', 'o3_mini' then true
96
+ when 'gpt41', 'gpt41_mini', 'gpt41_nano', 'chatgpt4o', 'gpt4o', 'gpt4o_mini', 'o1', 'o1_pro',
97
+ 'o3_mini' then true
92
98
  else false
93
99
  end
94
100
  end
@@ -98,6 +104,9 @@ module RubyLLM
98
104
  end
99
105
 
100
106
  PRICES = {
107
+ gpt41: { input: 2.0, output: 8.0, cached_input: 0.5 },
108
+ gpt41_mini: { input: 0.4, output: 1.6, cached_input: 0.1 },
109
+ gpt41_nano: { input: 0.1, output: 0.4 },
101
110
  chatgpt4o: { input: 5.0, output: 15.0 },
102
111
  gpt4: { input: 10.0, output: 30.0 },
103
112
  gpt4_turbo: { input: 10.0, output: 30.0 },
@@ -141,6 +150,12 @@ module RubyLLM
141
150
  prices[:input] || prices[:price] || default_input_price
142
151
  end
143
152
 
153
+ def cached_input_price_for(model_id)
154
+ family = model_family(model_id).to_sym
155
+ prices = PRICES.fetch(family, {})
156
+ prices[:cached_input]
157
+ end
158
+
144
159
  def output_price_for(model_id)
145
160
  family = model_family(model_id).to_sym
146
161
  prices = PRICES.fetch(family, { output: default_output_price })
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLLM
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carmine Paolino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-08 00:00:00.000000000 Z
11
+ date: 2025-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday-net_http
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: faraday-retry
71
85
  requirement: !ruby/object:Gem::Requirement