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).