ruby_llm 1.12.0 ā 1.13.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.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/generators/ruby_llm/chat_ui/templates/jobs/chat_response_job.rb.tt +1 -1
- data/lib/generators/ruby_llm/generator_helpers.rb +4 -0
- data/lib/generators/ruby_llm/install/install_generator.rb +5 -4
- data/lib/generators/ruby_llm/install/templates/create_chats_migration.rb.tt +1 -1
- data/lib/generators/ruby_llm/install/templates/create_messages_migration.rb.tt +1 -1
- data/lib/generators/ruby_llm/install/templates/create_models_migration.rb.tt +1 -6
- data/lib/generators/ruby_llm/install/templates/create_tool_calls_migration.rb.tt +1 -1
- data/lib/ruby_llm/active_record/acts_as.rb +8 -4
- data/lib/ruby_llm/active_record/acts_as_legacy.rb +85 -20
- data/lib/ruby_llm/active_record/chat_methods.rb +67 -16
- data/lib/ruby_llm/agent.rb +39 -8
- data/lib/ruby_llm/aliases.json +19 -9
- data/lib/ruby_llm/chat.rb +107 -11
- data/lib/ruby_llm/configuration.rb +18 -0
- data/lib/ruby_llm/connection.rb +10 -4
- data/lib/ruby_llm/content.rb +6 -2
- data/lib/ruby_llm/error.rb +32 -1
- data/lib/ruby_llm/message.rb +5 -3
- data/lib/ruby_llm/model/info.rb +1 -1
- data/lib/ruby_llm/models.json +3535 -2894
- data/lib/ruby_llm/models.rb +5 -3
- data/lib/ruby_llm/provider.rb +5 -1
- data/lib/ruby_llm/providers/anthropic/capabilities.rb +22 -4
- data/lib/ruby_llm/providers/anthropic/chat.rb +22 -5
- data/lib/ruby_llm/providers/anthropic/models.rb +1 -1
- data/lib/ruby_llm/providers/anthropic/tools.rb +20 -0
- data/lib/ruby_llm/providers/anthropic.rb +1 -1
- data/lib/ruby_llm/providers/azure/chat.rb +1 -1
- data/lib/ruby_llm/providers/azure/embeddings.rb +1 -1
- data/lib/ruby_llm/providers/azure/models.rb +1 -1
- data/lib/ruby_llm/providers/azure.rb +88 -0
- data/lib/ruby_llm/providers/bedrock/chat.rb +50 -5
- data/lib/ruby_llm/providers/bedrock/models.rb +17 -1
- data/lib/ruby_llm/providers/bedrock/streaming.rb +8 -4
- data/lib/ruby_llm/providers/bedrock.rb +5 -1
- data/lib/ruby_llm/providers/deepseek/capabilities.rb +8 -0
- data/lib/ruby_llm/providers/deepseek.rb +1 -1
- data/lib/ruby_llm/providers/gemini/capabilities.rb +8 -0
- data/lib/ruby_llm/providers/gemini/chat.rb +19 -4
- data/lib/ruby_llm/providers/gemini/images.rb +1 -1
- data/lib/ruby_llm/providers/gemini/streaming.rb +1 -1
- data/lib/ruby_llm/providers/gemini/tools.rb +19 -0
- data/lib/ruby_llm/providers/gpustack/capabilities.rb +20 -0
- data/lib/ruby_llm/providers/gpustack.rb +4 -0
- data/lib/ruby_llm/providers/mistral/capabilities.rb +8 -0
- data/lib/ruby_llm/providers/mistral/chat.rb +2 -1
- data/lib/ruby_llm/providers/ollama/capabilities.rb +20 -0
- data/lib/ruby_llm/providers/ollama.rb +7 -1
- data/lib/ruby_llm/providers/openai/capabilities.rb +10 -2
- data/lib/ruby_llm/providers/openai/chat.rb +15 -5
- data/lib/ruby_llm/providers/openai/media.rb +4 -1
- data/lib/ruby_llm/providers/openai/temperature.rb +2 -2
- data/lib/ruby_llm/providers/openai/tools.rb +27 -2
- data/lib/ruby_llm/providers/openrouter/chat.rb +19 -5
- data/lib/ruby_llm/providers/openrouter/images.rb +69 -0
- data/lib/ruby_llm/providers/openrouter.rb +31 -1
- data/lib/ruby_llm/providers/vertexai/models.rb +1 -1
- data/lib/ruby_llm/providers/vertexai.rb +14 -6
- data/lib/ruby_llm/stream_accumulator.rb +10 -5
- data/lib/ruby_llm/streaming.rb +6 -6
- data/lib/ruby_llm/tool.rb +48 -3
- data/lib/ruby_llm/version.rb +1 -1
- data/lib/tasks/models.rake +33 -7
- data/lib/tasks/release.rake +1 -1
- data/lib/tasks/ruby_llm.rake +7 -0
- data/lib/tasks/vcr.rake +1 -1
- metadata +8 -5
data/lib/tasks/models.rake
CHANGED
|
@@ -144,12 +144,17 @@ def status(provider_sym)
|
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
def generate_models_markdown
|
|
147
|
+
models = RubyLLM.models.all
|
|
148
|
+
total_models = models.count
|
|
149
|
+
provider_count = models.map(&:provider).uniq.count
|
|
150
|
+
generated_on = Time.now.utc.strftime('%Y-%m-%d')
|
|
151
|
+
|
|
147
152
|
<<~MARKDOWN
|
|
148
153
|
---
|
|
149
154
|
layout: default
|
|
150
155
|
title: Available Models
|
|
151
156
|
nav_order: 1
|
|
152
|
-
description: Browse
|
|
157
|
+
description: Browse #{total_models} AI models across #{provider_count} providers (not including local providers). Updated #{generated_on}.
|
|
153
158
|
redirect_from:
|
|
154
159
|
- /guides/available-models
|
|
155
160
|
---
|
|
@@ -170,11 +175,17 @@ def generate_models_markdown
|
|
|
170
175
|
|
|
171
176
|
_Model information enriched by [models.dev](https://models.dev) and our custom code._
|
|
172
177
|
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
Can't find a newly released model? Refresh your registry:
|
|
179
|
+
|
|
180
|
+
```ruby
|
|
181
|
+
# Plain Ruby
|
|
182
|
+
RubyLLM.models.refresh!
|
|
175
183
|
|
|
176
|
-
#
|
|
177
|
-
|
|
184
|
+
# Rails
|
|
185
|
+
Model.refresh!
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
See [Model Registry: Refreshing the Registry]({% link _advanced/models.md %}#refreshing-the-registry).
|
|
178
189
|
|
|
179
190
|
## Models by Provider
|
|
180
191
|
|
|
@@ -275,8 +286,8 @@ end
|
|
|
275
286
|
def models_table(models)
|
|
276
287
|
return '*No models found*' if models.none?
|
|
277
288
|
|
|
278
|
-
headers = ['Model', 'Provider', 'Context', 'Max Output', 'Standard Pricing (per 1M tokens)']
|
|
279
|
-
alignment = [':--', ':--', '--:', '--:', ':--']
|
|
289
|
+
headers = ['Model', 'Provider', 'I/O', 'Capabilities', 'Context', 'Max Output', 'Standard Pricing (per 1M tokens)']
|
|
290
|
+
alignment = [':--', ':--', ':--', ':--', '--:', '--:', ':--']
|
|
280
291
|
|
|
281
292
|
rows = models.sort_by { |m| [m.provider, m.name] }.map do |model|
|
|
282
293
|
pricing = standard_pricing_display(model)
|
|
@@ -284,6 +295,8 @@ def models_table(models)
|
|
|
284
295
|
[
|
|
285
296
|
model.id,
|
|
286
297
|
model.provider,
|
|
298
|
+
modalities_display(model),
|
|
299
|
+
list_display(model.capabilities),
|
|
287
300
|
model.context_window || '-',
|
|
288
301
|
model.max_output_tokens || '-',
|
|
289
302
|
pricing
|
|
@@ -301,6 +314,19 @@ def models_table(models)
|
|
|
301
314
|
table.join("\n")
|
|
302
315
|
end
|
|
303
316
|
|
|
317
|
+
def modalities_display(model)
|
|
318
|
+
input_modalities = list_display(model.modalities.input)
|
|
319
|
+
output_modalities = list_display(model.modalities.output)
|
|
320
|
+
"In: #{input_modalities}; Out: #{output_modalities}"
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def list_display(values)
|
|
324
|
+
items = Array(values).compact.map(&:to_s).reject(&:empty?)
|
|
325
|
+
return '-' if items.empty?
|
|
326
|
+
|
|
327
|
+
items.join(', ')
|
|
328
|
+
end
|
|
329
|
+
|
|
304
330
|
def standard_pricing_display(model)
|
|
305
331
|
pricing_data = model.pricing.to_h[:text_tokens]&.dig(:standard) || {}
|
|
306
332
|
|
data/lib/tasks/release.rake
CHANGED
|
@@ -26,7 +26,7 @@ namespace :release do # rubocop:disable Metrics/BlockLength
|
|
|
26
26
|
if stale_count.positive?
|
|
27
27
|
puts "\nšļø Removed #{stale_count} stale cassettes"
|
|
28
28
|
puts 'š Re-recording cassettes...'
|
|
29
|
-
|
|
29
|
+
run_parallel_rspec || exit(1)
|
|
30
30
|
puts 'ā
Cassettes refreshed!'
|
|
31
31
|
else
|
|
32
32
|
puts 'ā
No stale cassettes found'
|
data/lib/tasks/ruby_llm.rake
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
def run_parallel_rspec
|
|
4
|
+
workers = ENV.fetch('RSPEC_WORKERS', nil)
|
|
5
|
+
cmd = %w[bundle exec parallel_rspec]
|
|
6
|
+
cmd += ['-n', workers] if workers && !workers.empty?
|
|
7
|
+
system(*cmd)
|
|
8
|
+
end
|
|
9
|
+
|
|
3
10
|
namespace :ruby_llm do
|
|
4
11
|
desc 'Load models from models.json into the database'
|
|
5
12
|
task load_models: :environment do
|
data/lib/tasks/vcr.rake
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_llm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carmine Paolino
|
|
@@ -99,28 +99,28 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '1
|
|
102
|
+
version: '1'
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '1
|
|
109
|
+
version: '1'
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
111
|
name: ruby_llm-schema
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: 0
|
|
116
|
+
version: '0'
|
|
117
117
|
type: :runtime
|
|
118
118
|
prerelease: false
|
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|
|
121
121
|
- - "~>"
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 0
|
|
123
|
+
version: '0'
|
|
124
124
|
- !ruby/object:Gem::Dependency
|
|
125
125
|
name: zeitwerk
|
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -252,6 +252,7 @@ files:
|
|
|
252
252
|
- lib/ruby_llm/providers/gemini/tools.rb
|
|
253
253
|
- lib/ruby_llm/providers/gemini/transcription.rb
|
|
254
254
|
- lib/ruby_llm/providers/gpustack.rb
|
|
255
|
+
- lib/ruby_llm/providers/gpustack/capabilities.rb
|
|
255
256
|
- lib/ruby_llm/providers/gpustack/chat.rb
|
|
256
257
|
- lib/ruby_llm/providers/gpustack/media.rb
|
|
257
258
|
- lib/ruby_llm/providers/gpustack/models.rb
|
|
@@ -261,6 +262,7 @@ files:
|
|
|
261
262
|
- lib/ruby_llm/providers/mistral/embeddings.rb
|
|
262
263
|
- lib/ruby_llm/providers/mistral/models.rb
|
|
263
264
|
- lib/ruby_llm/providers/ollama.rb
|
|
265
|
+
- lib/ruby_llm/providers/ollama/capabilities.rb
|
|
264
266
|
- lib/ruby_llm/providers/ollama/chat.rb
|
|
265
267
|
- lib/ruby_llm/providers/ollama/media.rb
|
|
266
268
|
- lib/ruby_llm/providers/ollama/models.rb
|
|
@@ -278,6 +280,7 @@ files:
|
|
|
278
280
|
- lib/ruby_llm/providers/openai/transcription.rb
|
|
279
281
|
- lib/ruby_llm/providers/openrouter.rb
|
|
280
282
|
- lib/ruby_llm/providers/openrouter/chat.rb
|
|
283
|
+
- lib/ruby_llm/providers/openrouter/images.rb
|
|
281
284
|
- lib/ruby_llm/providers/openrouter/models.rb
|
|
282
285
|
- lib/ruby_llm/providers/openrouter/streaming.rb
|
|
283
286
|
- lib/ruby_llm/providers/perplexity.rb
|