ruby_llm 1.9.2 → 1.10.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 +3 -2
- data/lib/generators/ruby_llm/install/templates/create_messages_migration.rb.tt +3 -0
- data/lib/generators/ruby_llm/install/templates/create_tool_calls_migration.rb.tt +1 -0
- data/lib/generators/ruby_llm/upgrade_to_v1_10/templates/add_v1_10_message_columns.rb.tt +19 -0
- data/lib/generators/ruby_llm/upgrade_to_v1_10/upgrade_to_v1_10_generator.rb +50 -0
- data/lib/ruby_llm/active_record/acts_as_legacy.rb +5 -1
- data/lib/ruby_llm/active_record/chat_methods.rb +12 -0
- data/lib/ruby_llm/active_record/message_methods.rb +41 -8
- data/lib/ruby_llm/aliases.json +0 -12
- data/lib/ruby_llm/chat.rb +10 -7
- data/lib/ruby_llm/configuration.rb +1 -1
- data/lib/ruby_llm/message.rb +37 -11
- data/lib/ruby_llm/models.json +1059 -857
- data/lib/ruby_llm/models.rb +134 -12
- data/lib/ruby_llm/provider.rb +4 -3
- data/lib/ruby_llm/providers/anthropic/chat.rb +128 -13
- data/lib/ruby_llm/providers/anthropic/streaming.rb +25 -1
- data/lib/ruby_llm/providers/bedrock/chat.rb +58 -15
- data/lib/ruby_llm/providers/bedrock/streaming/content_extraction.rb +59 -2
- data/lib/ruby_llm/providers/bedrock/streaming/payload_processing.rb +5 -0
- data/lib/ruby_llm/providers/gemini/chat.rb +69 -3
- data/lib/ruby_llm/providers/gemini/streaming.rb +32 -1
- data/lib/ruby_llm/providers/gemini/tools.rb +16 -3
- data/lib/ruby_llm/providers/gpustack/chat.rb +1 -1
- data/lib/ruby_llm/providers/mistral/chat.rb +58 -1
- data/lib/ruby_llm/providers/ollama/chat.rb +1 -1
- data/lib/ruby_llm/providers/openai/capabilities.rb +6 -2
- data/lib/ruby_llm/providers/openai/chat.rb +87 -3
- data/lib/ruby_llm/providers/openai/streaming.rb +11 -3
- data/lib/ruby_llm/providers/openai/temperature.rb +28 -0
- data/lib/ruby_llm/providers/openai.rb +1 -1
- data/lib/ruby_llm/providers/openrouter/chat.rb +154 -0
- data/lib/ruby_llm/providers/openrouter/streaming.rb +74 -0
- data/lib/ruby_llm/providers/openrouter.rb +2 -0
- data/lib/ruby_llm/providers/vertexai.rb +5 -1
- data/lib/ruby_llm/stream_accumulator.rb +111 -14
- data/lib/ruby_llm/streaming.rb +54 -51
- data/lib/ruby_llm/thinking.rb +49 -0
- data/lib/ruby_llm/tokens.rb +47 -0
- data/lib/ruby_llm/tool_call.rb +6 -3
- data/lib/ruby_llm/version.rb +1 -1
- data/lib/tasks/models.rake +19 -12
- metadata +12 -5
data/lib/ruby_llm/tool_call.rb
CHANGED
|
@@ -4,19 +4,22 @@ module RubyLLM
|
|
|
4
4
|
# Represents a function call from an AI model to a Tool.
|
|
5
5
|
class ToolCall
|
|
6
6
|
attr_reader :id, :name, :arguments
|
|
7
|
+
attr_accessor :thought_signature
|
|
7
8
|
|
|
8
|
-
def initialize(id:, name:, arguments: {})
|
|
9
|
+
def initialize(id:, name:, arguments: {}, thought_signature: nil)
|
|
9
10
|
@id = id
|
|
10
11
|
@name = name
|
|
11
12
|
@arguments = arguments
|
|
13
|
+
@thought_signature = thought_signature
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def to_h
|
|
15
17
|
{
|
|
16
18
|
id: @id,
|
|
17
19
|
name: @name,
|
|
18
|
-
arguments: @arguments
|
|
19
|
-
|
|
20
|
+
arguments: @arguments,
|
|
21
|
+
thought_signature: @thought_signature
|
|
22
|
+
}.compact
|
|
20
23
|
end
|
|
21
24
|
end
|
|
22
25
|
end
|
data/lib/ruby_llm/version.rb
CHANGED
data/lib/tasks/models.rake
CHANGED
|
@@ -61,7 +61,8 @@ def configure_bedrock(config)
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def refresh_models
|
|
64
|
-
|
|
64
|
+
existing_models = RubyLLM::Models.read_from_json
|
|
65
|
+
initial_count = existing_models.size
|
|
65
66
|
puts "Refreshing models (#{initial_count} cached)..."
|
|
66
67
|
|
|
67
68
|
models = RubyLLM.models.refresh!
|
|
@@ -69,19 +70,29 @@ def refresh_models
|
|
|
69
70
|
if models.all.empty? && initial_count.zero?
|
|
70
71
|
puts 'Error: Failed to fetch models.'
|
|
71
72
|
exit(1)
|
|
72
|
-
elsif models.all.size == initial_count && initial_count.positive?
|
|
73
|
-
puts 'Warning: Model list unchanged.'
|
|
74
73
|
else
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
existing_data = sorted_models_data(existing_models)
|
|
75
|
+
new_data = sorted_models_data(models.all)
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if new_data == existing_data && initial_count.positive?
|
|
78
|
+
puts 'Warning: Model list unchanged.'
|
|
79
|
+
else
|
|
80
|
+
puts 'Validating models...'
|
|
81
|
+
validate_models!(models)
|
|
82
|
+
|
|
83
|
+
puts "Saving models.json (#{models.all.size} models)"
|
|
84
|
+
models.save_to_json
|
|
85
|
+
end
|
|
80
86
|
end
|
|
81
87
|
|
|
82
88
|
@models = models
|
|
83
89
|
end
|
|
84
90
|
|
|
91
|
+
def sorted_models_data(models)
|
|
92
|
+
models.map(&:to_h)
|
|
93
|
+
.sort_by { |model| [model[:provider].to_s, model[:id].to_s] }
|
|
94
|
+
end
|
|
95
|
+
|
|
85
96
|
def validate_models!(models)
|
|
86
97
|
schema_path = RubyLLM::Models.schema_file
|
|
87
98
|
models_data = models.all.map(&:to_h)
|
|
@@ -154,11 +165,7 @@ def generate_models_markdown
|
|
|
154
165
|
|
|
155
166
|
---
|
|
156
167
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
- **OpenAI, Anthropic, DeepSeek, Gemini, VertexAI**: Enriched by [models.dev](https://models.dev/) *([LLM metadata API](https://models.dev/api.json))*
|
|
160
|
-
- **OpenRouter**: Direct API
|
|
161
|
-
- **Others**: Local capabilities files
|
|
168
|
+
_Model information enriched by [models.dev](https://models.dev) and our custom code._
|
|
162
169
|
|
|
163
170
|
## Last Updated
|
|
164
171
|
{: .d-inline-block }
|
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.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carmine Paolino
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: 1.10.0
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: faraday-
|
|
55
|
+
name: faraday-retry
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - ">="
|
|
@@ -66,7 +66,7 @@ dependencies:
|
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '1'
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: faraday-
|
|
69
|
+
name: faraday-multipart
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - ">="
|
|
@@ -80,7 +80,7 @@ dependencies:
|
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '1'
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
|
-
name: faraday-
|
|
83
|
+
name: faraday-net_http
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
86
|
- - ">="
|
|
@@ -180,6 +180,8 @@ files:
|
|
|
180
180
|
- lib/generators/ruby_llm/install/templates/message_model.rb.tt
|
|
181
181
|
- lib/generators/ruby_llm/install/templates/model_model.rb.tt
|
|
182
182
|
- lib/generators/ruby_llm/install/templates/tool_call_model.rb.tt
|
|
183
|
+
- lib/generators/ruby_llm/upgrade_to_v1_10/templates/add_v1_10_message_columns.rb.tt
|
|
184
|
+
- lib/generators/ruby_llm/upgrade_to_v1_10/upgrade_to_v1_10_generator.rb
|
|
183
185
|
- lib/generators/ruby_llm/upgrade_to_v1_7/templates/migration.rb.tt
|
|
184
186
|
- lib/generators/ruby_llm/upgrade_to_v1_7/upgrade_to_v1_7_generator.rb
|
|
185
187
|
- lib/generators/ruby_llm/upgrade_to_v1_9/templates/add_v1_9_message_columns.rb.tt
|
|
@@ -271,10 +273,13 @@ files:
|
|
|
271
273
|
- lib/ruby_llm/providers/openai/models.rb
|
|
272
274
|
- lib/ruby_llm/providers/openai/moderation.rb
|
|
273
275
|
- lib/ruby_llm/providers/openai/streaming.rb
|
|
276
|
+
- lib/ruby_llm/providers/openai/temperature.rb
|
|
274
277
|
- lib/ruby_llm/providers/openai/tools.rb
|
|
275
278
|
- lib/ruby_llm/providers/openai/transcription.rb
|
|
276
279
|
- lib/ruby_llm/providers/openrouter.rb
|
|
280
|
+
- lib/ruby_llm/providers/openrouter/chat.rb
|
|
277
281
|
- lib/ruby_llm/providers/openrouter/models.rb
|
|
282
|
+
- lib/ruby_llm/providers/openrouter/streaming.rb
|
|
278
283
|
- lib/ruby_llm/providers/perplexity.rb
|
|
279
284
|
- lib/ruby_llm/providers/perplexity/capabilities.rb
|
|
280
285
|
- lib/ruby_llm/providers/perplexity/chat.rb
|
|
@@ -288,6 +293,8 @@ files:
|
|
|
288
293
|
- lib/ruby_llm/railtie.rb
|
|
289
294
|
- lib/ruby_llm/stream_accumulator.rb
|
|
290
295
|
- lib/ruby_llm/streaming.rb
|
|
296
|
+
- lib/ruby_llm/thinking.rb
|
|
297
|
+
- lib/ruby_llm/tokens.rb
|
|
291
298
|
- lib/ruby_llm/tool.rb
|
|
292
299
|
- lib/ruby_llm/tool_call.rb
|
|
293
300
|
- lib/ruby_llm/transcription.rb
|
|
@@ -309,7 +316,7 @@ metadata:
|
|
|
309
316
|
funding_uri: https://github.com/sponsors/crmne
|
|
310
317
|
rubygems_mfa_required: 'true'
|
|
311
318
|
post_install_message: |
|
|
312
|
-
Upgrading from RubyLLM
|
|
319
|
+
Upgrading from RubyLLM < 1.10.x? Check the upgrade guide for new features and migration instructions
|
|
313
320
|
--> https://rubyllm.com/upgrading/
|
|
314
321
|
rdoc_options: []
|
|
315
322
|
require_paths:
|