ruby_llm 1.4.0 → 1.5.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 +27 -5
- data/lib/generators/ruby_llm/install_generator.rb +7 -7
- data/lib/ruby_llm/configuration.rb +2 -0
- data/lib/ruby_llm/models.json +2437 -496
- data/lib/ruby_llm/providers/mistral/capabilities.rb +151 -0
- data/lib/ruby_llm/providers/mistral/chat.rb +26 -0
- data/lib/ruby_llm/providers/mistral/embeddings.rb +36 -0
- data/lib/ruby_llm/providers/mistral/models.rb +49 -0
- data/lib/ruby_llm/providers/mistral.rb +37 -0
- data/lib/ruby_llm/providers/perplexity/capabilities.rb +167 -0
- data/lib/ruby_llm/providers/perplexity/chat.rb +17 -0
- data/lib/ruby_llm/providers/perplexity/models.rb +42 -0
- data/lib/ruby_llm/providers/perplexity.rb +57 -0
- data/lib/ruby_llm/version.rb +1 -1
- data/lib/ruby_llm.rb +9 -5
- data/lib/tasks/models_docs.rake +5 -6
- data/lib/tasks/models_update.rake +2 -0
- metadata +10 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e3baec78d42e9655e26f1984b15d6b655d6f01aece629803dc6e4bc79f2563
|
4
|
+
data.tar.gz: 21dfafd1d8c6ed4b1980a9a04671aff8b4d242ee2ce596acddb947098750df42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7cb56063b748209085dc9e951981fe94c21ed1697b397efe7441fe43a185bddc45a46c2df77942ac12cef1b271dd502fd9e849a7964d477ca0e3a471317b555
|
7
|
+
data.tar.gz: 15d659d10f2d1389bc09e1e99bb89f6eebb51f446b930d7c67b54b6d848008bd233ecbda15c26682fc77a97b8a69f1cfe07246b5a4715727fbc0dee21909363f
|
data/README.md
CHANGED
@@ -15,6 +15,9 @@
|
|
15
15
|
<br>
|
16
16
|
<img src="https://raw.githubusercontent.com/gpustack/gpustack/main/docs/assets/gpustack-logo.png" alt="GPUStack" class="logo-medium" height="16">
|
17
17
|
|
18
|
+
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/mistral-color.svg" alt="Mistral" class="logo-medium">
|
19
|
+
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/mistral-text.svg" alt="Mistral" class="logo-small">
|
20
|
+
|
18
21
|
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/ollama.svg" alt="Ollama" class="logo-medium">
|
19
22
|
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/ollama-text.svg" alt="Ollama" class="logo-medium">
|
20
23
|
|
@@ -24,10 +27,12 @@
|
|
24
27
|
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openrouter.svg" alt="OpenRouter" class="logo-medium">
|
25
28
|
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openrouter-text.svg" alt="OpenRouter" class="logo-small">
|
26
29
|
|
30
|
+
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/perplexity-color.svg" alt="Perplexity" class="logo-medium">
|
31
|
+
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/perplexity-text.svg" alt="Perplexity" class="logo-small">
|
27
32
|
</div>
|
28
33
|
|
29
34
|
<div class="badge-container">
|
30
|
-
<a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg" alt="Gem Version" /></a>
|
35
|
+
<a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg?a=1" alt="Gem Version" /></a>
|
31
36
|
<a href="https://github.com/testdouble/standard"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Ruby Style Guide" /></a>
|
32
37
|
<a href="https://rubygems.org/gems/ruby_llm"><img alt="Gem Downloads" src="https://img.shields.io/gem/dt/ruby_llm"></a>
|
33
38
|
<a href="https://codecov.io/gh/crmne/ruby_llm"><img src="https://codecov.io/gh/crmne/ruby_llm/branch/main/graph/badge.svg" alt="codecov" /></a>
|
@@ -85,19 +90,36 @@ class Weather < RubyLLM::Tool
|
|
85
90
|
end
|
86
91
|
|
87
92
|
chat.with_tool(Weather).ask "What's the weather in Berlin? (52.5200, 13.4050)"
|
93
|
+
|
94
|
+
# Get structured output with JSON schemas
|
95
|
+
class ProductSchema < RubyLLM::Schema
|
96
|
+
string :name, description: "Product name"
|
97
|
+
number :price, description: "Price in USD"
|
98
|
+
array :features, description: "Key features" do
|
99
|
+
string description: "Feature description"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
response = chat.with_schema(ProductSchema)
|
104
|
+
.ask "Analyze this product description", with: "product.txt"
|
105
|
+
# response.content => { "name" => "...", "price" => 99.99, "features" => [...] }
|
88
106
|
```
|
89
107
|
|
90
108
|
## Core Capabilities
|
91
109
|
|
92
|
-
* 💬 **Unified Chat:** Converse with models from OpenAI, Anthropic, Gemini, Bedrock, OpenRouter, DeepSeek, Ollama, or any OpenAI-compatible API using `RubyLLM.chat`.
|
110
|
+
* 💬 **Unified Chat:** Converse with models from OpenAI, Anthropic, Gemini, Bedrock, OpenRouter, DeepSeek, Perplexity, Mistral, Ollama, or any OpenAI-compatible API using `RubyLLM.chat`.
|
93
111
|
* 👁️ **Vision:** Analyze images within chats.
|
94
112
|
* 🔊 **Audio:** Transcribe and understand audio content.
|
95
|
-
* 📄 **Document Analysis:** Extract information from PDFs, text files, and
|
113
|
+
* 📄 **Document Analysis:** Extract information from PDFs, text files, CSV, JSON, XML, Markdown, and code files.
|
96
114
|
* 🖼️ **Image Generation:** Create images with `RubyLLM.paint`.
|
97
115
|
* 📊 **Embeddings:** Generate text embeddings for vector search with `RubyLLM.embed`.
|
98
116
|
* 🔧 **Tools (Function Calling):** Let AI models call your Ruby code using `RubyLLM::Tool`.
|
117
|
+
* 📋 **Structured Output:** Guarantee responses conform to JSON schemas with `RubyLLM::Schema`.
|
99
118
|
* 🚂 **Rails Integration:** Easily persist chats, messages, and tool calls using `acts_as_chat` and `acts_as_message`.
|
100
119
|
* 🌊 **Streaming:** Process responses in real-time with idiomatic Ruby blocks.
|
120
|
+
* ⚡ **Async Support:** Built-in fiber-based concurrency for high-performance operations.
|
121
|
+
* 🎯 **Smart Configuration:** Global and scoped configs with automatic retries and proxy support.
|
122
|
+
* 📚 **Model Registry:** Access 500+ models with capability detection and pricing info.
|
101
123
|
|
102
124
|
## Installation
|
103
125
|
|
@@ -124,7 +146,7 @@ See the [Installation Guide](https://rubyllm.com/installation) for full details.
|
|
124
146
|
Add persistence to your chat models effortlessly:
|
125
147
|
|
126
148
|
```bash
|
127
|
-
# Generate models and migrations
|
149
|
+
# Generate models and migrations
|
128
150
|
rails generate ruby_llm:install
|
129
151
|
```
|
130
152
|
|
@@ -173,4 +195,4 @@ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for deta
|
|
173
195
|
|
174
196
|
## License
|
175
197
|
|
176
|
-
Released under the MIT License.
|
198
|
+
Released under the MIT License.
|
@@ -30,7 +30,7 @@ module RubyLLM
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def postgresql?
|
33
|
-
ActiveRecord::Base.connection.adapter_name.downcase.include?('postgresql')
|
33
|
+
::ActiveRecord::Base.connection.adapter_name.downcase.include?('postgresql')
|
34
34
|
rescue StandardError
|
35
35
|
false
|
36
36
|
end
|
@@ -81,15 +81,15 @@ module RubyLLM
|
|
81
81
|
migration_template 'create_chats_migration.rb.tt',
|
82
82
|
"db/migrate/create_#{options[:chat_model_name].tableize}.rb"
|
83
83
|
|
84
|
-
# Then create tool_calls
|
85
|
-
sleep 1 # Ensure different timestamp
|
86
|
-
migration_template 'create_tool_calls_migration.rb.tt',
|
87
|
-
"db/migrate/create_#{options[:tool_call_model_name].tableize}.rb"
|
88
|
-
|
89
|
-
# Finally create messages table
|
84
|
+
# Then create messages table (must come before tool_calls due to foreign key)
|
90
85
|
sleep 1 # Ensure different timestamp
|
91
86
|
migration_template 'create_messages_migration.rb.tt',
|
92
87
|
"db/migrate/create_#{options[:message_model_name].tableize}.rb"
|
88
|
+
|
89
|
+
# Finally create tool_calls table (references messages)
|
90
|
+
sleep 1 # Ensure different timestamp
|
91
|
+
migration_template 'create_tool_calls_migration.rb.tt',
|
92
|
+
"db/migrate/create_#{options[:tool_call_model_name].tableize}.rb"
|
93
93
|
end
|
94
94
|
|
95
95
|
def create_model_files
|
@@ -18,6 +18,7 @@ module RubyLLM
|
|
18
18
|
:anthropic_api_key,
|
19
19
|
:gemini_api_key,
|
20
20
|
:deepseek_api_key,
|
21
|
+
:perplexity_api_key,
|
21
22
|
:bedrock_api_key,
|
22
23
|
:bedrock_secret_key,
|
23
24
|
:bedrock_region,
|
@@ -26,6 +27,7 @@ module RubyLLM
|
|
26
27
|
:ollama_api_base,
|
27
28
|
:gpustack_api_base,
|
28
29
|
:gpustack_api_key,
|
30
|
+
:mistral_api_key,
|
29
31
|
# Default models
|
30
32
|
:default_model,
|
31
33
|
:default_embedding_model,
|