ruby_llm 1.7.1 → 1.8.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/install_generator.rb +8 -2
- data/lib/generators/ruby_llm/install/templates/add_references_to_chats_tool_calls_and_messages_migration.rb.tt +9 -0
- data/lib/generators/ruby_llm/install/templates/create_chats_migration.rb.tt +0 -1
- data/lib/generators/ruby_llm/install/templates/create_messages_migration.rb.tt +0 -3
- data/lib/generators/ruby_llm/install/templates/create_tool_calls_migration.rb.tt +0 -1
- data/lib/ruby_llm/attachment.rb +5 -0
- data/lib/ruby_llm/configuration.rb +2 -0
- data/lib/ruby_llm/mime_type.rb +4 -0
- data/lib/ruby_llm/model/info.rb +4 -0
- data/lib/ruby_llm/models.json +780 -511
- data/lib/ruby_llm/models.rb +7 -3
- data/lib/ruby_llm/moderation.rb +56 -0
- data/lib/ruby_llm/provider.rb +6 -0
- data/lib/ruby_llm/providers/gemini/capabilities.rb +5 -0
- data/lib/ruby_llm/providers/openai/moderation.rb +34 -0
- data/lib/ruby_llm/providers/openai.rb +1 -0
- data/lib/ruby_llm/railtie.rb +1 -1
- data/lib/ruby_llm/version.rb +1 -1
- data/lib/ruby_llm.rb +4 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def0767fe1f3e052f42bfddc4d3b69733d51cf8d39d057a08145307ef5f362a0
|
4
|
+
data.tar.gz: fba9605e4458efb173dff1d131f0124c8252c4d71ca7a23527eb0d0a2543c75a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 622b3b02ba5fb0cc0c49d7bc2d515e92abd0fa5714db70c8b0af64868cee9229b05ddefa6a990ab5f3788e7e07589628bd9f347f921346449a2154575e1e1ac1
|
7
|
+
data.tar.gz: 890020ebc2817a3a388278510eaa2b31699eb660cce29ed1c19ebd5a67b3775f8ff83d9be58b31bac825719c6683d7ffcc321251a6f89dc58bafd135ea51ec25
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
Battle tested at [<picture><source media="(prefers-color-scheme: dark)" srcset="https://chatwithwork.com/logotype-dark.svg"><img src="https://chatwithwork.com/logotype.svg" alt="Chat with Work" height="30" align="absmiddle"></picture>](https://chatwithwork.com) — *Claude Code for your documents*
|
11
11
|
|
12
|
-
[](https://badge.fury.io/rb/ruby_llm)
|
13
13
|
[](https://github.com/testdouble/standard)
|
14
14
|
[](https://rubygems.org/gems/ruby_llm)
|
15
15
|
[](https://codecov.io/gh/crmne/ruby_llm)
|
@@ -41,6 +41,7 @@ chat.ask "What's the best way to learn Ruby?"
|
|
41
41
|
```ruby
|
42
42
|
# Analyze any file type
|
43
43
|
chat.ask "What's in this image?", with: "ruby_conf.jpg"
|
44
|
+
chat.ask "What's happening in this video?", with: "video.mp4"
|
44
45
|
chat.ask "Describe this meeting", with: "meeting.wav"
|
45
46
|
chat.ask "Summarize this document", with: "contract.pdf"
|
46
47
|
chat.ask "Explain this code", with: "app.rb"
|
@@ -100,7 +101,7 @@ response = chat.with_schema(ProductSchema).ask "Analyze this product", with: "pr
|
|
100
101
|
## Features
|
101
102
|
|
102
103
|
* **Chat:** Conversational AI with `RubyLLM.chat`
|
103
|
-
* **Vision:** Analyze images and
|
104
|
+
* **Vision:** Analyze images and videos
|
104
105
|
* **Audio:** Transcribe and understand speech
|
105
106
|
* **Documents:** Extract from PDFs, CSVs, JSON, any file type
|
106
107
|
* **Image generation:** Create images with `RubyLLM.paint`
|
@@ -32,12 +32,12 @@ module RubyLLM
|
|
32
32
|
migration_template 'create_chats_migration.rb.tt',
|
33
33
|
"db/migrate/create_#{chat_table_name}.rb"
|
34
34
|
|
35
|
-
# Then create messages table
|
35
|
+
# Then create messages table
|
36
36
|
sleep 1 # Ensure different timestamp
|
37
37
|
migration_template 'create_messages_migration.rb.tt',
|
38
38
|
"db/migrate/create_#{message_table_name}.rb"
|
39
39
|
|
40
|
-
# Then create tool_calls table
|
40
|
+
# Then create tool_calls table
|
41
41
|
sleep 1 # Ensure different timestamp
|
42
42
|
migration_template 'create_tool_calls_migration.rb.tt',
|
43
43
|
"db/migrate/create_#{tool_call_table_name}.rb"
|
@@ -46,6 +46,12 @@ module RubyLLM
|
|
46
46
|
sleep 1 # Ensure different timestamp
|
47
47
|
migration_template 'create_models_migration.rb.tt',
|
48
48
|
"db/migrate/create_#{model_table_name}.rb"
|
49
|
+
|
50
|
+
# Add references to chats, tool_calls and messages.
|
51
|
+
sleep 1 # Ensure different timestamp
|
52
|
+
migration_template 'add_references_to_chats_tool_calls_and_messages_migration.rb.tt',
|
53
|
+
'db/migrate/add_references_to_' \
|
54
|
+
"#{chat_table_name}_#{tool_call_table_name}_and_#{message_table_name}.rb"
|
49
55
|
end
|
50
56
|
|
51
57
|
def create_model_files
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddReferencesTo<%= "#{chat_model_name.gsub('::', '').pluralize}#{tool_call_model_name.gsub('::', '').pluralize}And#{message_model_name.gsub('::', '').pluralize}" %> < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
add_reference :<%= chat_table_name %>, :<%= model_table_name.singularize %>, foreign_key: true
|
4
|
+
add_reference :<%= tool_call_table_name %>, :<%= message_table_name.singularize %>, null: false, foreign_key: true
|
5
|
+
add_reference :<%= message_table_name %>, :<%= chat_table_name.singularize %>, null: false, foreign_key: true
|
6
|
+
add_reference :<%= message_table_name %>, :<%= model_table_name.singularize %>, foreign_key: true
|
7
|
+
add_reference :<%= message_table_name %>, :<%= tool_call_table_name.singularize %>, foreign_key: true
|
8
|
+
end
|
9
|
+
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
class Create<%= message_model_name.gsub('::', '').pluralize %> < ActiveRecord::Migration<%= migration_version %>
|
2
2
|
def change
|
3
3
|
create_table :<%= message_table_name %> do |t|
|
4
|
-
t.references :<%= chat_table_name.singularize %>, null: false, foreign_key: true
|
5
4
|
t.string :role, null: false
|
6
5
|
t.text :content
|
7
|
-
t.references :<%= model_table_name.singularize %>, foreign_key: true
|
8
6
|
t.integer :input_tokens
|
9
7
|
t.integer :output_tokens
|
10
|
-
t.references :<%= tool_call_table_name.singularize %>, foreign_key: true
|
11
8
|
t.timestamps
|
12
9
|
end
|
13
10
|
|
@@ -2,7 +2,6 @@
|
|
2
2
|
class Create<%= tool_call_model_name.gsub('::', '').pluralize %> < ActiveRecord::Migration<%= migration_version %>
|
3
3
|
def change
|
4
4
|
create_table :<%= tool_call_table_name %> do |t|
|
5
|
-
t.references :<%= message_table_name.singularize %>, null: false, foreign_key: true
|
6
5
|
t.string :tool_call_id, null: false
|
7
6
|
t.string :name, null: false
|
8
7
|
t.<%= postgresql? ? 'jsonb' : 'json' %> :arguments, default: {}
|
data/lib/ruby_llm/attachment.rb
CHANGED
@@ -76,6 +76,7 @@ module RubyLLM
|
|
76
76
|
|
77
77
|
def type
|
78
78
|
return :image if image?
|
79
|
+
return :video if video?
|
79
80
|
return :audio if audio?
|
80
81
|
return :pdf if pdf?
|
81
82
|
return :text if text?
|
@@ -87,6 +88,10 @@ module RubyLLM
|
|
87
88
|
RubyLLM::MimeType.image? mime_type
|
88
89
|
end
|
89
90
|
|
91
|
+
def video?
|
92
|
+
RubyLLM::MimeType.video? mime_type
|
93
|
+
end
|
94
|
+
|
90
95
|
def audio?
|
91
96
|
RubyLLM::MimeType.audio? mime_type
|
92
97
|
end
|
@@ -26,6 +26,7 @@ module RubyLLM
|
|
26
26
|
# Default models
|
27
27
|
:default_model,
|
28
28
|
:default_embedding_model,
|
29
|
+
:default_moderation_model,
|
29
30
|
:default_image_model,
|
30
31
|
# Model registry
|
31
32
|
:model_registry_class,
|
@@ -54,6 +55,7 @@ module RubyLLM
|
|
54
55
|
|
55
56
|
@default_model = 'gpt-4.1-nano'
|
56
57
|
@default_embedding_model = 'text-embedding-3-small'
|
58
|
+
@default_moderation_model = 'omni-moderation-latest'
|
57
59
|
@default_image_model = 'gpt-image-1'
|
58
60
|
|
59
61
|
@model_registry_class = 'Model'
|
data/lib/ruby_llm/mime_type.rb
CHANGED