Skip to content

Commit b20d5e4

Browse files
committed
Update README and documentation for improved layout and feature clarity
1 parent 98db1c8 commit b20d5e4

File tree

3 files changed

+145
-22
lines changed

3 files changed

+145
-22
lines changed

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22

33
A delightful Ruby way to work with AI. No configuration madness, no complex callbacks, no handler hell – just beautiful, expressive Ruby code.
44

5-
<p align="center">
5+
<div style="display: flex; align-items: center; flex-wrap: wrap; gap: 4px;">
66
<img src="https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" alt="OpenAI" height="40" width="120">
77
&nbsp;&nbsp;&nbsp;&nbsp;
88
<img src="https://upload.wikimedia.org/wikipedia/commons/7/78/Anthropic_logo.svg" alt="Anthropic" height="40" width="120">
99
&nbsp;&nbsp;&nbsp;&nbsp;
1010
<img src="https://upload.wikimedia.org/wikipedia/commons/8/8a/Google_Gemini_logo.svg" alt="Google" height="40" width="120">
1111
&nbsp;&nbsp;&nbsp;&nbsp;
1212
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ec/DeepSeek_logo.svg" alt="DeepSeek" height="40" width="120">
13-
</p>
13+
</div>
1414

15-
<p align="center">
16-
<a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg" alt="Gem Version" /></a>
17-
<a href="https://github.com/testdouble/standard"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Ruby Style Guide" /></a>
18-
<a href="https://rubygems.org/gems/ruby_llm"><img alt="Gem Downloads" src="https://img.shields.io/gem/dt/ruby_llm"></a>
19-
<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>
20-
</p>
15+
<a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg" alt="Gem Version" /></a>
16+
<a href="https://github.com/testdouble/standard"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Ruby Style Guide" /></a>
17+
<a href="https://rubygems.org/gems/ruby_llm"><img alt="Gem Downloads" src="https://img.shields.io/gem/dt/ruby_llm"></a>
18+
<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>
2119

2220
🤺 Battle tested at [💬 Chat with Work](https://chatwithwork.com)
2321

@@ -27,6 +25,17 @@ Every AI provider comes with its own client library, its own response format, it
2725

2826
RubyLLM fixes all that. One beautiful API for everything. One consistent format. Minimal dependencies — just Faraday and Zeitwerk. Because working with AI should be a joy, not a chore.
2927

28+
## Features
29+
30+
- 💬 **Chat** with OpenAI, Anthropic, Gemini, and DeepSeek models
31+
- 👁️ **Vision and Audio** understanding
32+
- 📄 **PDF Analysis** for analyzing documents
33+
- 🖼️ **Image generation** with DALL-E and other providers
34+
- 📊 **Embeddings** for vector search and semantic analysis
35+
- 🔧 **Tools** that let AI use your Ruby code
36+
- 🚂 **Rails integration** to persist chats and messages with ActiveRecord
37+
- 🌊 **Streaming** responses with proper Ruby patterns
38+
3039
## What makes it great
3140

3241
```ruby

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ search:
1717

1818
# Navigation structure
1919
nav_external_links:
20-
- title: RubyLLM on GitHub
20+
- title: GitHub
2121
url: https://github.com/crmne/ruby_llm
2222
hide_icon: false
2323

docs/index.md

Lines changed: 127 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,41 @@ permalink: /
1212
A delightful Ruby way to work with AI through a unified interface to OpenAI, Anthropic, Google, and DeepSeek.
1313
{: .fs-6 .fw-300 }
1414

15-
[Get started now]({% link installation.md %}){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 }
16-
[View on GitHub](https://github.com/crmne/ruby_llm){: .btn .fs-5 .mb-4 .mb-md-0 }
15+
<div style="display: flex; align-items: center; flex-wrap: wrap; gap: 4px;">
16+
<a href="{% link installation.md %}" class="btn btn-primary fs-5 mb-4 mb-md-0 mr-2" style="margin: 0;">Get started</a>
17+
<a href="https://github.com/crmne/ruby_llm" class="btn fs-5 mb-4 mb-md-0 mr-2" style="margin: 0;">GitHub</a>
18+
<iframe src="https://ghbtns.com/github-btn.html?user=crmne&repo=ruby_llm&type=star&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub" style="vertical-align: middle; display: inline-block;"></iframe>
19+
</div>
1720

1821
---
19-
<p align="center">
22+
<div style="display: flex; align-items: center; flex-wrap: wrap; gap: 4px;">
2023
<img src="https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" alt="OpenAI" height="40" width="120">
2124
&nbsp;&nbsp;&nbsp;&nbsp;
2225
<img src="https://upload.wikimedia.org/wikipedia/commons/7/78/Anthropic_logo.svg" alt="Anthropic" height="40" width="120">
2326
&nbsp;&nbsp;&nbsp;&nbsp;
2427
<img src="https://upload.wikimedia.org/wikipedia/commons/8/8a/Google_Gemini_logo.svg" alt="Google" height="40" width="120">
2528
&nbsp;&nbsp;&nbsp;&nbsp;
2629
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ec/DeepSeek_logo.svg" alt="DeepSeek" height="40" width="120">
27-
</p>
30+
</div>
2831

29-
<p align="center">
30-
<a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg" alt="Gem Version" /></a>
31-
<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-
<a href="https://rubygems.org/gems/ruby_llm"><img alt="Gem Total Downloads" src="https://img.shields.io/gem/dt/ruby_llm"></a>
33-
<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>
34-
</p>
32+
<a href="https://badge.fury.io/rb/ruby_llm"><img src="https://badge.fury.io/rb/ruby_llm.svg" alt="Gem Version" /></a>
33+
<a href="https://github.com/testdouble/standard"><img src="https://img.shields.io/badge/code_style-standard-brightgreen.svg" alt="Ruby Style Guide" /></a>
34+
<a href="https://rubygems.org/gems/ruby_llm"><img alt="Gem Total Downloads" src="https://img.shields.io/gem/dt/ruby_llm"></a>
35+
<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>
3536

3637
🤺 Battle tested at [💬 Chat with Work](https://chatwithwork.com)
3738

3839
---
3940

40-
## Overview
41+
## The problem with AI libraries
4142

42-
RubyLLM provides a beautiful, unified interface to modern AI services, including:
43+
Every AI provider comes with its own client library, its own response format, its own conventions for streaming, and its own way of handling errors. Want to use multiple providers? Prepare to juggle incompatible APIs and bloated dependencies.
4344

44-
- 💬 **Chat** with OpenAI GPT, Anthropic Claude, Google Gemini, and DeepSeek models
45+
RubyLLM fixes all that. One beautiful API for everything. One consistent format. Minimal dependencies — just Faraday and Zeitwerk. Because working with AI should be a joy, not a chore.
46+
47+
## Features
48+
49+
- 💬 **Chat** with OpenAI, Anthropic, Gemini, and DeepSeek models
4550
- 👁️ **Vision and Audio** understanding
4651
- 📄 **PDF Analysis** for analyzing documents
4752
- 🖼️ **Image generation** with DALL-E and other providers
@@ -50,6 +55,41 @@ RubyLLM provides a beautiful, unified interface to modern AI services, including
5055
- 🚂 **Rails integration** to persist chats and messages with ActiveRecord
5156
- 🌊 **Streaming** responses with proper Ruby patterns
5257

58+
## What makes it great
59+
60+
```ruby
61+
# Just ask questions
62+
chat = RubyLLM.chat
63+
chat.ask "What's the best way to learn Ruby?"
64+
65+
# Analyze images
66+
chat.ask "What's in this image?", with: { image: "ruby_conf.jpg" }
67+
68+
# Analyze audio recordings
69+
chat.ask "Describe this meeting", with: { audio: "meeting.wav" }
70+
71+
# Analyze documents
72+
chat.ask "Summarize this document", with: { pdf: "contract.pdf" }
73+
74+
# Generate images
75+
RubyLLM.paint "a sunset over mountains in watercolor style"
76+
77+
# Create vector embeddings
78+
RubyLLM.embed "Ruby is elegant and expressive"
79+
80+
# Let AI use your code
81+
class Calculator < RubyLLM::Tool
82+
description "Performs calculations"
83+
param :expression, type: :string, desc: "Math expression to evaluate"
84+
85+
def execute(expression:)
86+
eval(expression).to_s
87+
end
88+
end
89+
90+
chat.with_tool(Calculator).ask "What's 123 * 456?"
91+
```
92+
5393
## Quick start
5494

5595
```ruby
@@ -74,7 +114,81 @@ claude_chat = RubyLLM.chat(model: 'claude-3-7-sonnet-20250219')
74114
claude_chat.ask "Summarize this document", with: { pdf: "contract.pdf" }
75115
```
76116

117+
## Have great conversations
118+
119+
```ruby
120+
# Start a chat with the default model (GPT-4o-mini)
121+
chat = RubyLLM.chat
122+
123+
# Or specify what you want
124+
chat = RubyLLM.chat(model: 'claude-3-7-sonnet-20250219')
125+
126+
# Simple questions just work
127+
chat.ask "What's the difference between attr_reader and attr_accessor?"
128+
129+
# Multi-turn conversations are seamless
130+
chat.ask "Could you give me an example?"
131+
132+
# Stream responses in real-time
133+
chat.ask "Tell me a story about a Ruby programmer" do |chunk|
134+
print chunk.content
135+
end
136+
137+
# Need a different model mid-conversation? No problem
138+
chat.with_model('gemini-2.0-flash').ask "What's your favorite algorithm?"
139+
```
140+
141+
## Rails integration that makes sense
142+
143+
```ruby
144+
# app/models/chat.rb
145+
class Chat < ApplicationRecord
146+
acts_as_chat
147+
148+
# Works great with Turbo
149+
broadcasts_to ->(chat) { "chat_#{chat.id}" }
150+
end
151+
152+
# app/models/message.rb
153+
class Message < ApplicationRecord
154+
acts_as_message
155+
end
156+
157+
# app/models/tool_call.rb
158+
class ToolCall < ApplicationRecord
159+
acts_as_tool_call
160+
end
161+
162+
# In your controller
163+
chat = Chat.create!(model_id: "gpt-4o-mini")
164+
chat.ask("What's your favorite Ruby gem?") do |chunk|
165+
Turbo::StreamsChannel.broadcast_append_to(
166+
chat,
167+
target: "response",
168+
partial: "messages/chunk",
169+
locals: { chunk: chunk }
170+
)
171+
end
172+
173+
# That's it - chat history is automatically saved
174+
```
175+
176+
## Features Overview
177+
178+
- 💬 **Chat** with OpenAI GPT, Anthropic Claude, Google Gemini, and DeepSeek models
179+
- 👁️ **Vision and Audio** understanding
180+
- 📄 **PDF Analysis** for analyzing documents
181+
- 🖼️ **Image generation** with DALL-E and other providers
182+
- 📊 **Embeddings** for vector search and semantic analysis
183+
- 🔧 **Tools** that let AI use your Ruby code
184+
- 🚂 **Rails integration** to persist chats and messages with ActiveRecord
185+
- 🌊 **Streaming** responses with proper Ruby patterns
186+
77187
## Learn more
78188

79189
- [Installation]({% link installation.md %})
80190
- [Guides]({% link guides/index.md %})
191+
192+
## License
193+
194+
Released under the MIT License.

0 commit comments

Comments
 (0)