ruby_llm_community 1.2.0 → 1.3.1
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 +13 -9
- data/lib/generators/ruby_llm/chat_ui/chat_ui_generator.rb +127 -67
- data/lib/generators/ruby_llm/chat_ui/templates/controllers/chats_controller.rb.tt +12 -12
- data/lib/generators/ruby_llm/chat_ui/templates/controllers/messages_controller.rb.tt +7 -7
- data/lib/generators/ruby_llm/chat_ui/templates/controllers/models_controller.rb.tt +4 -4
- data/lib/generators/ruby_llm/chat_ui/templates/jobs/chat_response_job.rb.tt +6 -6
- data/lib/generators/ruby_llm/chat_ui/templates/views/chats/_chat.html.erb.tt +4 -4
- data/lib/generators/ruby_llm/chat_ui/templates/views/chats/_form.html.erb.tt +5 -5
- data/lib/generators/ruby_llm/chat_ui/templates/views/chats/index.html.erb.tt +5 -5
- data/lib/generators/ruby_llm/chat_ui/templates/views/chats/new.html.erb.tt +4 -4
- data/lib/generators/ruby_llm/chat_ui/templates/views/chats/show.html.erb.tt +8 -8
- data/lib/generators/ruby_llm/chat_ui/templates/views/messages/_content.html.erb.tt +1 -0
- data/lib/generators/ruby_llm/chat_ui/templates/views/messages/_form.html.erb.tt +5 -5
- data/lib/generators/ruby_llm/chat_ui/templates/views/messages/_message.html.erb.tt +9 -6
- data/lib/generators/ruby_llm/chat_ui/templates/views/messages/_tool_calls.html.erb.tt +7 -0
- data/lib/generators/ruby_llm/chat_ui/templates/views/messages/create.turbo_stream.erb.tt +5 -5
- data/lib/generators/ruby_llm/chat_ui/templates/views/models/_model.html.erb.tt +9 -9
- data/lib/generators/ruby_llm/chat_ui/templates/views/models/index.html.erb.tt +4 -6
- data/lib/generators/ruby_llm/chat_ui/templates/views/models/show.html.erb.tt +11 -11
- data/lib/generators/ruby_llm/generator_helpers.rb +152 -87
- data/lib/generators/ruby_llm/install/install_generator.rb +75 -79
- data/lib/generators/ruby_llm/install/templates/create_messages_migration.rb.tt +3 -0
- data/lib/generators/ruby_llm/install/templates/create_models_migration.rb.tt +5 -0
- data/lib/generators/ruby_llm/install/templates/create_tool_calls_migration.rb.tt +7 -1
- data/lib/generators/ruby_llm/install/templates/initializer.rb.tt +1 -1
- data/lib/generators/ruby_llm/upgrade_to_v1_7/upgrade_to_v1_7_generator.rb +88 -85
- data/lib/generators/ruby_llm/upgrade_to_v1_9/templates/add_v1_9_message_columns.rb.tt +15 -0
- data/lib/generators/ruby_llm/upgrade_to_v1_9/upgrade_to_v1_9_generator.rb +49 -0
- data/lib/ruby_llm/active_record/acts_as.rb +23 -16
- data/lib/ruby_llm/active_record/chat_methods.rb +41 -13
- data/lib/ruby_llm/active_record/message_methods.rb +11 -2
- data/lib/ruby_llm/active_record/model_methods.rb +1 -1
- data/lib/ruby_llm/aliases.json +61 -32
- data/lib/ruby_llm/attachment.rb +42 -11
- data/lib/ruby_llm/chat.rb +13 -2
- data/lib/ruby_llm/configuration.rb +6 -1
- data/lib/ruby_llm/connection.rb +4 -4
- data/lib/ruby_llm/content.rb +23 -0
- data/lib/ruby_llm/message.rb +17 -9
- data/lib/ruby_llm/model/info.rb +4 -0
- data/lib/ruby_llm/models.json +7157 -6089
- data/lib/ruby_llm/models.rb +14 -22
- data/lib/ruby_llm/provider.rb +27 -5
- data/lib/ruby_llm/providers/anthropic/chat.rb +18 -5
- data/lib/ruby_llm/providers/anthropic/content.rb +44 -0
- data/lib/ruby_llm/providers/anthropic/media.rb +6 -5
- data/lib/ruby_llm/providers/anthropic/models.rb +9 -2
- data/lib/ruby_llm/providers/anthropic/tools.rb +20 -18
- data/lib/ruby_llm/providers/bedrock/media.rb +2 -1
- data/lib/ruby_llm/providers/bedrock/streaming/content_extraction.rb +9 -2
- data/lib/ruby_llm/providers/gemini/chat.rb +353 -72
- data/lib/ruby_llm/providers/gemini/media.rb +59 -1
- data/lib/ruby_llm/providers/gemini/tools.rb +146 -25
- data/lib/ruby_llm/providers/gemini/transcription.rb +116 -0
- data/lib/ruby_llm/providers/gemini.rb +2 -1
- data/lib/ruby_llm/providers/gpustack/media.rb +1 -0
- data/lib/ruby_llm/providers/ollama/media.rb +1 -0
- data/lib/ruby_llm/providers/openai/capabilities.rb +15 -7
- data/lib/ruby_llm/providers/openai/chat.rb +7 -3
- data/lib/ruby_llm/providers/openai/media.rb +2 -1
- data/lib/ruby_llm/providers/openai/streaming.rb +7 -3
- data/lib/ruby_llm/providers/openai/tools.rb +34 -12
- data/lib/ruby_llm/providers/openai/transcription.rb +70 -0
- data/lib/ruby_llm/providers/openai_base.rb +1 -0
- data/lib/ruby_llm/providers/vertexai/transcription.rb +16 -0
- data/lib/ruby_llm/providers/vertexai.rb +11 -11
- data/lib/ruby_llm/railtie.rb +24 -22
- data/lib/ruby_llm/stream_accumulator.rb +8 -12
- data/lib/ruby_llm/tool.rb +126 -0
- data/lib/ruby_llm/transcription.rb +35 -0
- data/lib/ruby_llm/utils.rb +46 -0
- data/lib/ruby_llm/version.rb +1 -1
- data/lib/ruby_llm_community.rb +7 -1
- metadata +27 -3
|
@@ -8,6 +8,7 @@ module RubyLLM
|
|
|
8
8
|
include VertexAI::Streaming
|
|
9
9
|
include VertexAI::Embeddings
|
|
10
10
|
include VertexAI::Models
|
|
11
|
+
include VertexAI::Transcription
|
|
11
12
|
|
|
12
13
|
def initialize(config)
|
|
13
14
|
super
|
|
@@ -19,9 +20,14 @@ module RubyLLM
|
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def headers
|
|
22
|
-
|
|
23
|
-
'Authorization' =>
|
|
24
|
-
|
|
23
|
+
if defined?(VCR) && !VCR.current_cassette.recording?
|
|
24
|
+
{ 'Authorization' => 'Bearer test-token' }
|
|
25
|
+
else
|
|
26
|
+
initialize_authorizer unless @authorizer
|
|
27
|
+
@authorizer.apply({})
|
|
28
|
+
end
|
|
29
|
+
rescue Google::Auth::AuthorizationError => e
|
|
30
|
+
raise UnauthorizedError.new(nil, "Invalid Google Cloud credentials for Vertex AI: #{e.message}")
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
class << self
|
|
@@ -32,13 +38,6 @@ module RubyLLM
|
|
|
32
38
|
|
|
33
39
|
private
|
|
34
40
|
|
|
35
|
-
def access_token
|
|
36
|
-
return 'test-token' if defined?(VCR) && !VCR.current_cassette.recording?
|
|
37
|
-
|
|
38
|
-
initialize_authorizer unless @authorizer
|
|
39
|
-
@authorizer.fetch_access_token!['access_token']
|
|
40
|
-
end
|
|
41
|
-
|
|
42
41
|
def initialize_authorizer
|
|
43
42
|
require 'googleauth'
|
|
44
43
|
@authorizer = ::Google::Auth.get_application_default(
|
|
@@ -48,7 +47,8 @@ module RubyLLM
|
|
|
48
47
|
]
|
|
49
48
|
)
|
|
50
49
|
rescue LoadError
|
|
51
|
-
raise Error,
|
|
50
|
+
raise Error,
|
|
51
|
+
'The googleauth gem ~> 1.15 is required for Vertex AI. Please add it to your Gemfile: gem "googleauth"'
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
end
|
data/lib/ruby_llm/railtie.rb
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
if defined?(Rails::Railtie)
|
|
4
|
+
module RubyLLM
|
|
5
|
+
# Rails integration for RubyLLM
|
|
6
|
+
class Railtie < Rails::Railtie
|
|
7
|
+
initializer 'ruby_llm.inflections' do
|
|
8
|
+
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
9
|
+
inflect.acronym 'RubyLLM'
|
|
10
|
+
end
|
|
9
11
|
end
|
|
10
|
-
end
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
initializer 'ruby_llm.active_record' do
|
|
14
|
+
ActiveSupport.on_load :active_record do
|
|
15
|
+
if RubyLLM.config.use_new_acts_as
|
|
16
|
+
require 'ruby_llm/active_record/acts_as'
|
|
17
|
+
::ActiveRecord::Base.include RubyLLM::ActiveRecord::ActsAs
|
|
18
|
+
else
|
|
19
|
+
require 'ruby_llm/active_record/acts_as_legacy'
|
|
20
|
+
::ActiveRecord::Base.include RubyLLM::ActiveRecord::ActsAsLegacy
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
Rails.logger.warn(
|
|
23
|
+
"\n!!! RubyLLM's legacy acts_as API is deprecated and will be removed in RubyLLM 2.0.0. " \
|
|
24
|
+
"Please consult the migration guide at https://rubyllm.com/upgrading-to-1-7/\n"
|
|
25
|
+
)
|
|
26
|
+
end
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
|
-
end
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
rake_tasks do
|
|
31
|
+
load 'tasks/ruby_llm.rake'
|
|
32
|
+
end
|
|
31
33
|
end
|
|
32
34
|
end
|
|
33
35
|
end
|
|
@@ -8,10 +8,10 @@ module RubyLLM
|
|
|
8
8
|
def initialize
|
|
9
9
|
@content = nil
|
|
10
10
|
@tool_calls = {}
|
|
11
|
-
@input_tokens =
|
|
12
|
-
@output_tokens =
|
|
13
|
-
@cached_tokens =
|
|
14
|
-
@cache_creation_tokens =
|
|
11
|
+
@input_tokens = nil
|
|
12
|
+
@output_tokens = nil
|
|
13
|
+
@cached_tokens = nil
|
|
14
|
+
@cache_creation_tokens = nil
|
|
15
15
|
@latest_tool_call_id = nil
|
|
16
16
|
@reasoning_id = nil
|
|
17
17
|
end
|
|
@@ -40,10 +40,10 @@ module RubyLLM
|
|
|
40
40
|
content: content,
|
|
41
41
|
model_id: model_id,
|
|
42
42
|
tool_calls: tool_calls_from_stream,
|
|
43
|
-
input_tokens:
|
|
44
|
-
output_tokens:
|
|
45
|
-
cached_tokens:
|
|
46
|
-
cache_creation_tokens:
|
|
43
|
+
input_tokens: @input_tokens,
|
|
44
|
+
output_tokens: @output_tokens,
|
|
45
|
+
cached_tokens: @cached_tokens,
|
|
46
|
+
cache_creation_tokens: @cache_creation_tokens,
|
|
47
47
|
raw: response
|
|
48
48
|
)
|
|
49
49
|
end
|
|
@@ -58,10 +58,6 @@ module RubyLLM
|
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def positive_or_nil(value)
|
|
62
|
-
value.positive? ? value : nil
|
|
63
|
-
end
|
|
64
|
-
|
|
65
61
|
def accumulate_content(new_content)
|
|
66
62
|
return unless new_content
|
|
67
63
|
|
data/lib/ruby_llm/tool.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'ruby_llm/schema'
|
|
4
|
+
|
|
3
5
|
module RubyLLM
|
|
4
6
|
# Parameter definition for Tool methods.
|
|
5
7
|
class Parameter
|
|
@@ -29,6 +31,8 @@ module RubyLLM
|
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
class << self
|
|
34
|
+
attr_reader :params_schema_definition
|
|
35
|
+
|
|
32
36
|
def description(text = nil)
|
|
33
37
|
return @description unless text
|
|
34
38
|
|
|
@@ -42,6 +46,20 @@ module RubyLLM
|
|
|
42
46
|
def parameters
|
|
43
47
|
@parameters ||= {}
|
|
44
48
|
end
|
|
49
|
+
|
|
50
|
+
def params(schema = nil, &block)
|
|
51
|
+
@params_schema_definition = SchemaDefinition.new(schema:, block:)
|
|
52
|
+
self
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def with_params(**params)
|
|
56
|
+
@provider_params = params
|
|
57
|
+
self
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def provider_params
|
|
61
|
+
@provider_params ||= {}
|
|
62
|
+
end
|
|
45
63
|
end
|
|
46
64
|
|
|
47
65
|
def name
|
|
@@ -63,6 +81,23 @@ module RubyLLM
|
|
|
63
81
|
self.class.parameters
|
|
64
82
|
end
|
|
65
83
|
|
|
84
|
+
def provider_params
|
|
85
|
+
self.class.provider_params
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def params_schema
|
|
89
|
+
return @params_schema if defined?(@params_schema)
|
|
90
|
+
|
|
91
|
+
@params_schema = begin
|
|
92
|
+
definition = self.class.params_schema_definition
|
|
93
|
+
if definition&.present?
|
|
94
|
+
definition.json_schema
|
|
95
|
+
elsif parameters.any?
|
|
96
|
+
SchemaDefinition.from_parameters(parameters)&.json_schema
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
66
101
|
def call(args)
|
|
67
102
|
RubyLLM.logger.debug "Tool #{name} called with: #{args.inspect}"
|
|
68
103
|
result = execute(**args.transform_keys(&:to_sym))
|
|
@@ -79,5 +114,96 @@ module RubyLLM
|
|
|
79
114
|
def halt(message)
|
|
80
115
|
Halt.new(message)
|
|
81
116
|
end
|
|
117
|
+
|
|
118
|
+
# Wraps schema handling for tool parameters, supporting JSON Schema hashes,
|
|
119
|
+
# RubyLLM::Schema instances/classes, and DSL blocks.
|
|
120
|
+
class SchemaDefinition
|
|
121
|
+
def self.from_parameters(parameters)
|
|
122
|
+
return nil if parameters.nil? || parameters.empty?
|
|
123
|
+
|
|
124
|
+
properties = parameters.to_h do |name, param|
|
|
125
|
+
schema = {
|
|
126
|
+
type: map_type(param.type),
|
|
127
|
+
description: param.description
|
|
128
|
+
}.compact
|
|
129
|
+
|
|
130
|
+
schema[:items] = default_items_schema if schema[:type] == 'array'
|
|
131
|
+
|
|
132
|
+
[name.to_s, schema]
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
required = parameters.select { |_, param| param.required }.keys.map(&:to_s)
|
|
136
|
+
|
|
137
|
+
json_schema = {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: properties,
|
|
140
|
+
required: required,
|
|
141
|
+
additionalProperties: false,
|
|
142
|
+
strict: true
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
new(schema: json_schema)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def self.map_type(type)
|
|
149
|
+
case type.to_s
|
|
150
|
+
when 'integer', 'int' then 'integer'
|
|
151
|
+
when 'number', 'float', 'double' then 'number'
|
|
152
|
+
when 'boolean' then 'boolean'
|
|
153
|
+
when 'array' then 'array'
|
|
154
|
+
when 'object' then 'object'
|
|
155
|
+
else
|
|
156
|
+
'string'
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def self.default_items_schema
|
|
161
|
+
{ type: 'string' }
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def initialize(schema: nil, block: nil)
|
|
165
|
+
@schema = schema
|
|
166
|
+
@block = block
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def present?
|
|
170
|
+
@schema || @block
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def json_schema
|
|
174
|
+
@json_schema ||= RubyLLM::Utils.deep_stringify_keys(resolve_schema)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
private
|
|
178
|
+
|
|
179
|
+
def resolve_schema
|
|
180
|
+
return resolve_direct_schema(@schema) if @schema
|
|
181
|
+
return build_from_block(&@block) if @block
|
|
182
|
+
|
|
183
|
+
nil
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def resolve_direct_schema(schema)
|
|
187
|
+
return extract_schema(schema.to_json_schema) if schema.respond_to?(:to_json_schema)
|
|
188
|
+
return RubyLLM::Utils.deep_dup(schema) if schema.is_a?(Hash)
|
|
189
|
+
if schema.is_a?(Class) && schema.instance_methods.include?(:to_json_schema)
|
|
190
|
+
return extract_schema(schema.new.to_json_schema)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
nil
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def build_from_block(&)
|
|
197
|
+
schema_class = RubyLLM::Schema.create(&)
|
|
198
|
+
extract_schema(schema_class.new.to_json_schema)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def extract_schema(schema_hash)
|
|
202
|
+
return nil unless schema_hash.is_a?(Hash)
|
|
203
|
+
|
|
204
|
+
schema = schema_hash[:schema] || schema_hash['schema'] || schema_hash
|
|
205
|
+
RubyLLM::Utils.deep_dup(schema)
|
|
206
|
+
end
|
|
207
|
+
end
|
|
82
208
|
end
|
|
83
209
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RubyLLM
|
|
4
|
+
# Represents a transcription of audio content.
|
|
5
|
+
class Transcription
|
|
6
|
+
attr_reader :text, :model, :language, :duration, :segments, :input_tokens, :output_tokens
|
|
7
|
+
|
|
8
|
+
def initialize(text:, model:, **attributes)
|
|
9
|
+
@text = text
|
|
10
|
+
@model = model
|
|
11
|
+
@language = attributes[:language]
|
|
12
|
+
@duration = attributes[:duration]
|
|
13
|
+
@segments = attributes[:segments]
|
|
14
|
+
@input_tokens = attributes[:input_tokens]
|
|
15
|
+
@output_tokens = attributes[:output_tokens]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.transcribe(audio_file, **kwargs)
|
|
19
|
+
model = kwargs.delete(:model)
|
|
20
|
+
language = kwargs.delete(:language)
|
|
21
|
+
provider = kwargs.delete(:provider)
|
|
22
|
+
assume_model_exists = kwargs.delete(:assume_model_exists) { false }
|
|
23
|
+
context = kwargs.delete(:context)
|
|
24
|
+
options = kwargs
|
|
25
|
+
|
|
26
|
+
config = context&.config || RubyLLM.config
|
|
27
|
+
model ||= config.default_transcription_model
|
|
28
|
+
model, provider_instance = Models.resolve(model, provider: provider, assume_exists: assume_model_exists,
|
|
29
|
+
config: config)
|
|
30
|
+
model_id = model.id
|
|
31
|
+
|
|
32
|
+
provider_instance.transcribe(audio_file, model: model_id, language:, **options)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/ruby_llm/utils.rb
CHANGED
|
@@ -41,5 +41,51 @@ module RubyLLM
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
def deep_dup(value)
|
|
46
|
+
case value
|
|
47
|
+
when Hash
|
|
48
|
+
value.each_with_object({}) do |(key, val), duped|
|
|
49
|
+
duped[deep_dup(key)] = deep_dup(val)
|
|
50
|
+
end
|
|
51
|
+
when Array
|
|
52
|
+
value.map { |item| deep_dup(item) }
|
|
53
|
+
else
|
|
54
|
+
begin
|
|
55
|
+
value.dup
|
|
56
|
+
rescue TypeError
|
|
57
|
+
value
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def deep_stringify_keys(value)
|
|
63
|
+
case value
|
|
64
|
+
when Hash
|
|
65
|
+
value.each_with_object({}) do |(key, val), result|
|
|
66
|
+
result[key.to_s] = deep_stringify_keys(val)
|
|
67
|
+
end
|
|
68
|
+
when Array
|
|
69
|
+
value.map { |item| deep_stringify_keys(item) }
|
|
70
|
+
when Symbol
|
|
71
|
+
value.to_s
|
|
72
|
+
else
|
|
73
|
+
value
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def deep_symbolize_keys(value)
|
|
78
|
+
case value
|
|
79
|
+
when Hash
|
|
80
|
+
value.each_with_object({}) do |(key, val), result|
|
|
81
|
+
symbolized_key = key.respond_to?(:to_sym) ? key.to_sym : key
|
|
82
|
+
result[symbolized_key] = deep_symbolize_keys(val)
|
|
83
|
+
end
|
|
84
|
+
when Array
|
|
85
|
+
value.map { |item| deep_symbolize_keys(item) }
|
|
86
|
+
else
|
|
87
|
+
value
|
|
88
|
+
end
|
|
89
|
+
end
|
|
44
90
|
end
|
|
45
91
|
end
|
data/lib/ruby_llm/version.rb
CHANGED
data/lib/ruby_llm_community.rb
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
require 'base64'
|
|
4
4
|
require 'event_stream_parser'
|
|
5
5
|
require 'faraday'
|
|
6
|
-
require 'faraday/retry'
|
|
7
6
|
require 'faraday/multipart'
|
|
7
|
+
require 'faraday/retry'
|
|
8
8
|
|
|
9
9
|
require 'json'
|
|
10
10
|
require 'logger'
|
|
11
|
+
require 'marcel'
|
|
11
12
|
require 'securerandom'
|
|
12
13
|
require 'zeitwerk'
|
|
13
14
|
|
|
@@ -33,6 +34,7 @@ loader.inflector.inflect(
|
|
|
33
34
|
loader.ignore("#{__dir__}/shims")
|
|
34
35
|
loader.ignore("#{__dir__}/tasks")
|
|
35
36
|
loader.ignore("#{__dir__}/generators")
|
|
37
|
+
loader.ignore("#{__dir__}/ruby_llm/railtie.rb")
|
|
36
38
|
loader.setup
|
|
37
39
|
|
|
38
40
|
# This is a shim for the RubyLLM gem.
|
|
@@ -66,6 +68,10 @@ module RubyLLM
|
|
|
66
68
|
Image.paint(...)
|
|
67
69
|
end
|
|
68
70
|
|
|
71
|
+
def transcribe(...)
|
|
72
|
+
Transcription.transcribe(...)
|
|
73
|
+
end
|
|
74
|
+
|
|
69
75
|
def models
|
|
70
76
|
Models.instance
|
|
71
77
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_llm_community
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Shippy
|
|
@@ -107,6 +107,20 @@ dependencies:
|
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
109
|
version: '1.0'
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: ruby_llm-schema
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: 0.2.1
|
|
117
|
+
type: :runtime
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: 0.2.1
|
|
110
124
|
- !ruby/object:Gem::Dependency
|
|
111
125
|
name: zeitwerk
|
|
112
126
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -146,8 +160,10 @@ files:
|
|
|
146
160
|
- lib/generators/ruby_llm/chat_ui/templates/views/chats/index.html.erb.tt
|
|
147
161
|
- lib/generators/ruby_llm/chat_ui/templates/views/chats/new.html.erb.tt
|
|
148
162
|
- lib/generators/ruby_llm/chat_ui/templates/views/chats/show.html.erb.tt
|
|
163
|
+
- lib/generators/ruby_llm/chat_ui/templates/views/messages/_content.html.erb.tt
|
|
149
164
|
- lib/generators/ruby_llm/chat_ui/templates/views/messages/_form.html.erb.tt
|
|
150
165
|
- lib/generators/ruby_llm/chat_ui/templates/views/messages/_message.html.erb.tt
|
|
166
|
+
- lib/generators/ruby_llm/chat_ui/templates/views/messages/_tool_calls.html.erb.tt
|
|
151
167
|
- lib/generators/ruby_llm/chat_ui/templates/views/messages/create.turbo_stream.erb.tt
|
|
152
168
|
- lib/generators/ruby_llm/chat_ui/templates/views/models/_model.html.erb.tt
|
|
153
169
|
- lib/generators/ruby_llm/chat_ui/templates/views/models/index.html.erb.tt
|
|
@@ -166,6 +182,8 @@ files:
|
|
|
166
182
|
- lib/generators/ruby_llm/install/templates/tool_call_model.rb.tt
|
|
167
183
|
- lib/generators/ruby_llm/upgrade_to_v1_7/templates/migration.rb.tt
|
|
168
184
|
- lib/generators/ruby_llm/upgrade_to_v1_7/upgrade_to_v1_7_generator.rb
|
|
185
|
+
- lib/generators/ruby_llm/upgrade_to_v1_9/templates/add_v1_9_message_columns.rb.tt
|
|
186
|
+
- lib/generators/ruby_llm/upgrade_to_v1_9/upgrade_to_v1_9_generator.rb
|
|
169
187
|
- lib/ruby_llm/active_record/acts_as.rb
|
|
170
188
|
- lib/ruby_llm/active_record/acts_as_legacy.rb
|
|
171
189
|
- lib/ruby_llm/active_record/chat_methods.rb
|
|
@@ -201,6 +219,7 @@ files:
|
|
|
201
219
|
- lib/ruby_llm/providers/anthropic.rb
|
|
202
220
|
- lib/ruby_llm/providers/anthropic/capabilities.rb
|
|
203
221
|
- lib/ruby_llm/providers/anthropic/chat.rb
|
|
222
|
+
- lib/ruby_llm/providers/anthropic/content.rb
|
|
204
223
|
- lib/ruby_llm/providers/anthropic/embeddings.rb
|
|
205
224
|
- lib/ruby_llm/providers/anthropic/media.rb
|
|
206
225
|
- lib/ruby_llm/providers/anthropic/models.rb
|
|
@@ -230,6 +249,7 @@ files:
|
|
|
230
249
|
- lib/ruby_llm/providers/gemini/models.rb
|
|
231
250
|
- lib/ruby_llm/providers/gemini/streaming.rb
|
|
232
251
|
- lib/ruby_llm/providers/gemini/tools.rb
|
|
252
|
+
- lib/ruby_llm/providers/gemini/transcription.rb
|
|
233
253
|
- lib/ruby_llm/providers/gpustack.rb
|
|
234
254
|
- lib/ruby_llm/providers/gpustack/chat.rb
|
|
235
255
|
- lib/ruby_llm/providers/gpustack/media.rb
|
|
@@ -255,6 +275,7 @@ files:
|
|
|
255
275
|
- lib/ruby_llm/providers/openai/response_media.rb
|
|
256
276
|
- lib/ruby_llm/providers/openai/streaming.rb
|
|
257
277
|
- lib/ruby_llm/providers/openai/tools.rb
|
|
278
|
+
- lib/ruby_llm/providers/openai/transcription.rb
|
|
258
279
|
- lib/ruby_llm/providers/openai_base.rb
|
|
259
280
|
- lib/ruby_llm/providers/openrouter.rb
|
|
260
281
|
- lib/ruby_llm/providers/openrouter/models.rb
|
|
@@ -272,6 +293,7 @@ files:
|
|
|
272
293
|
- lib/ruby_llm/providers/vertexai/embeddings.rb
|
|
273
294
|
- lib/ruby_llm/providers/vertexai/models.rb
|
|
274
295
|
- lib/ruby_llm/providers/vertexai/streaming.rb
|
|
296
|
+
- lib/ruby_llm/providers/vertexai/transcription.rb
|
|
275
297
|
- lib/ruby_llm/providers/xai.rb
|
|
276
298
|
- lib/ruby_llm/providers/xai/capabilities.rb
|
|
277
299
|
- lib/ruby_llm/providers/xai/chat.rb
|
|
@@ -281,6 +303,7 @@ files:
|
|
|
281
303
|
- lib/ruby_llm/streaming.rb
|
|
282
304
|
- lib/ruby_llm/tool.rb
|
|
283
305
|
- lib/ruby_llm/tool_call.rb
|
|
306
|
+
- lib/ruby_llm/transcription.rb
|
|
284
307
|
- lib/ruby_llm/utils.rb
|
|
285
308
|
- lib/ruby_llm/version.rb
|
|
286
309
|
- lib/ruby_llm_community.rb
|
|
@@ -298,10 +321,11 @@ metadata:
|
|
|
298
321
|
changelog_uri: https://github.com/tpaulshippy/ruby_llm_community/commits/main
|
|
299
322
|
documentation_uri: https://rubyllm.com
|
|
300
323
|
bug_tracker_uri: https://github.com/tpaulshippy/ruby_llm_community/issues
|
|
324
|
+
funding_uri: https://github.com/sponsors/crmne
|
|
301
325
|
rubygems_mfa_required: 'true'
|
|
302
326
|
post_install_message: |
|
|
303
|
-
Upgrading from RubyLLM <= 1.
|
|
304
|
-
--> https://rubyllm.com/upgrading
|
|
327
|
+
Upgrading from RubyLLM <= 1.8.x? Check the upgrade guide for new features and migration instructions
|
|
328
|
+
--> https://rubyllm.com/upgrading/
|
|
305
329
|
rdoc_options: []
|
|
306
330
|
require_paths:
|
|
307
331
|
- lib
|