crmne/ruby_llm
One delightful Ruby framework for every major AI provider. Build AI agents, chatbots, RAG apps, and multimodal workflows in beautiful, expressive code.
What it solves
RubyLLM 是一个统一的框架,用于在 Ruby 与 Rails 应用中集成 AI 能力。它通过提供单一且一致的接口给各种 LLM 提供商,消除必须管理多个臃肿且供应商专属客户端与不一致 API 格式的需求。
How it works
该框架提供高级的 Ruby API,帮助开发者与广泛的 AI 模型(包括 OpenAI、Anthropic、Google,以及通过 Ollama 的本地模型)交互。它抽象化模型特定的逻辑,使开发者在不重新编写代码的情况下切换供应商。框架支持多模态输入(图片、视频、音频和文档),并内置工具用于创建代理、处理结构化 JSON 输出,以及直接通过 ActiveRecord 与 Rails 集成。
Who it’s for
适用于想在 Ruby 与 Rails 中构建 AI 驱动功能(如聊天机器人、代理和 RAG 系统),且不想被单一 AI 供应商的 SDK 锁定的开发者。
Highlights
- Unified Interface: One API for OpenAI, xAI, Anthropic, Gemini, VertexAI, Bedrock, DeepSeek, Mistral, Ollama, and more.
- Multimodal Support: Native handling of images, video, audio transcription, and document extraction (PDFs, CSVs, etc.).
- Agentic Capabilities: Built-in support for creating reusable agents with specific instructions and custom Ruby tools.
- Rails Integration: Includes
acts_as_chatfor ActiveRecord and an optional ready-to-use chat UI. - Advanced AI Features: Support for streaming responses, structured output via schemas, embeddings, and provider-side batch processing.
- Lightweight: Minimal dependencies (Faraday, Zeitwerk, and Marcel).