메뉴
HN
Hacker News 34일 전

루비온(RubyLLM): 주요 AI 제공업체를 위한 통합 프레임워크

IMP
7/10
핵심 요약

루비온(RubyLLM)은 OpenAI, Anthropic, 로컬 모델 등 주요 AI 제공업체들의 복잡하고 제각각인 API를 하나의 간결한 인터페이스로 통합한 루비 프레임워크입니다. 채팅, 이미지/오디오 분석, 도구(Tool) 사용이 가능한 AI 에이전트, 구조화된 JSON 출력 등 다양한 AI 워크플로우를 직관적인 코드로 쉽게 구축할 수 있습니다. 레일즈(Rails)와의 강력한 통합 기능을 제공하며, 개발자가 복잡한 API 연동에 쏟을 시간을 줄여 핵심 비즈니스 로직에 집중할 수 있게 해줍니다.

번역된 본문

모든 주요 AI 제공업체를 위한 단일롭고 아름다운 루비 프레임워크입니다. 챗봇, AI 에이전트, RAG(검색 증강 생성) 애플리케이션, 콘텐츠 생성기 등 상상할 수 있는 모든 AI 워크플로우를 쉽게 구축할 수 있습니다. GitHub에서 시작해 보세요. 현재 완전히 프라이빗한 업무용 AI 환경에서 실전 테스트를 거쳤습니다. 단 2분 만에 작동하는 루비 AI 채팅을 구축해 보세요. RubyLLM을 사용하고 계신가요? 여러분의 이야기를 공유해 주세요! (단 5분이면 충분합니다.)

왜 RubyLLM인가요? 모든 AI 제공업체는 각자의 무거운 클라이언트를 제공합니다. API가 다르고, 응답 형식이 다르며, 규칙마저 다릅니다. 정말 지루하고 피곤한 작업입니다. RubyLLM은 이 모든 것을 위한 하나의 아름다운 프레임워크를 제공합니다. GPT를 사용하든, Claude를 사용하든, 로컬의 Ollama를 사용하든 동일한 인터페이스를 사용할 수 있습니다. 의존성은 단 세 개뿐입니다: Faraday, Zeitwerk, 그리고 Marcel. 끝입니다.

코드를 보여드리겠습니다:

# 그냥 질문하세요
chat = RubyLLM.chat
chat.ask "루비를 배우는 가장 좋은 방법은 무엇인가요?"

# 모든 파일 유형 분석
chat.ask "이 이미지에 무엇이 있나요?", with: "ruby_conf.jpg"
chat.ask "이 비디오에서 무슨 일이 일어나고 있나요?", with: "video.mp4"
chat.ask "이 회의를 설명해 주세요", with: "meeting.wav"
chat.ask "이 문서를 요약해 주세요", with: "contract.pdf"
chat.ask "이 코드를 설명해 주세요", with: "app.rb"

# 여러 파일을 한 번에 처리
chat.ask "이 파일들을 분석해 주세요", with: ["diagram.png", "report.pdf", "notes.txt"]

# 스트리밍 응답
chat.ask "루비에 대한 이야기를 들려주세요" do |chunk|
  print chunk.content
end

# 이미지 생성
RubyLLM.paint "수채화 스타일의 산 너머 노을"

# 임베딩 생성
RubyLLM.embed "루비는 우아하고 표현력이 풍부합니다"

# 오디오를 텍스트로 변환 (전사)
RubyLLM.transcribe "meeting.wav"

# 안전을 위한 콘텐츠 검열
RubyLLM.moderate "이 텍스트가 안전한지 확인해 주세요"

# AI가 여러분의 코드를 사용하게 하기
class Weather < RubyLLM::Tool
  desc "현재 날씨 가져오기"
  def execute(latitude:, longitude:)
    url = "https://api.open-meteo.com/v1/forecast?latitude=#{latitude}&longitude=#{longitude}&current=temperature_2m,wind_speed_10m"
    JSON.parse(Faraday.get(url).body)
  end
end

chat.with_tool(Weather).ask "베를린의 날씨는 어떤가요?"

# 지침(Instructions)과 도구(Tools)를 활용한 에이전트 정의
class WeatherAssistant < RubyLLM::Agent
  model "gpt-5-nano"
  instructions "간결하게 대답하고 날씨 확인은 항상 도구를 사용하세요."
  tools Weather
end

WeatherAssistant.new.ask "베를린의 날씨는 어떤가요?"

# 구조화된 출력 받기
class ProductSchema < RubyLLM::Schema
  string :name
  number :price
  array :features do
    string
  end
end

response = chat.with_schema(ProductSchema).ask "이 제품을 분석해 주세요", with: "product.txt"

주요 기능:

  • 채팅: RubyLLM.chat를 이용한 대화형 AI
  • 비전(Vision): 이미지 및 동영상 분석
  • 오디오: RubyLLM.transcribe를 이용한 음성 전사 및 이해
  • 문서: PDF, CSV, JSON 등 모든 파일 형식에서 데이터 추출
  • 이미지 생성: RubyLLM.paint를 이용한 이미지 생성
  • 임베딩: RubyLLM.embed를 이용한 임베딩 생성
  • 검열(Moderation): RubyLLM.moderate를 이용한 콘텐츠 안전성 확인
  • 도구(Tools): AI가 루비 메서드를 직접 호출
  • 에이전트: RubyLLM::Agent를 이용한 재사용 가능한 어시스턴트
  • 구조화된 출력: 그대로 작동하는 JSON 스키마 지원
  • 스트리밍: 블록을 활용한 실시간 응답
  • 레일즈(Rails): acts_as_chat를 통한 ActiveRecord 통합
  • 비동기(Async): 파이버(Fiber) 기반의 동시성 처리
  • 모델 레지스트리: 기능 감지 및 가격 정보가 포함된 800개 이상의 모델
  • 확장된 사고(Extended thinking): 모델의 사고 과정 제어, 확인 및 영구 저장
  • 제공업체: OpenAI, xAI, Anthropic, Gemini, VertexAI, Bedrock, DeepSeek, Mistral, Ollama, OpenRouter, Perplexity, GPUStack 및 모든 OpenAI 호환 API

설치 방법: Gemfile에 추가하세요: gem 'ruby_llm' 그런 다음 bundle install을 실행합니다. API 키를 설정하세요:

# config/initializers/ruby_llm.rb
RubyLLM.configure do |config|
  config.openai_api_key = ENV['OPENAI_API_KEY']
end

레일즈(Rails) 연동: 레일즈 통합 설치: bin/rails generate ruby_llm:install bin/rails db:migrate bin/rails ruby_llm:load_models (v1.13+ 필요)

채팅 UI 추가 (선택 사항): bin/rails generate ruby_llm:chat_ui

class Chat < ApplicationRecord
  acts_as_chat
end

chat = Chat.create! model: "claude-sonnet-4"
chat.ask "이 파일에 무엇이 있나요?", with: "report.pdf"

http://localhost:3000/chats에 접속하시면 바로 사용할 수 있는 채팅 인터페이스가 준비되어 있습니다!

원문 보기
원문 보기 (영어)
Copy page Star A single, beautiful Ruby framework for all major AI providers. Easily build chatbots, AI agents, RAG applications, content generators, and every AI workflow you can think of. Get started GitHub Battle tested at - Fully private work AI Build a working Ruby AI chat in two minutes Using RubyLLM? Share your story ! Takes 5 minutes. Why RubyLLM? Every AI provider ships their own bloated client. Different APIs. Different response formats. Different conventions. It’s exhausting. RubyLLM gives you one beautiful framework for all of them. Same interface whether you’re using GPT, Claude, or your local Ollama. Just three dependencies: Faraday, Zeitwerk, and Marcel. That’s it. Show me the code # Just ask questions chat = RubyLLM . chat chat . ask "What's the best way to learn Ruby?" # Analyze any file type chat . ask "What's in this image?" , with: "ruby_conf.jpg" chat . ask "What's happening in this video?" , with: "video.mp4" chat . ask "Describe this meeting" , with: "meeting.wav" chat . ask "Summarize this document" , with: "contract.pdf" chat . ask "Explain this code" , with: "app.rb" # Multiple files at once chat . ask "Analyze these files" , with: [ "diagram.png" , "report.pdf" , "notes.txt" ] # Stream responses chat . ask "Tell me a story about Ruby" do | chunk | print chunk . content end # Generate images RubyLLM . paint "a sunset over mountains in watercolor style" # Create embeddings RubyLLM . embed "Ruby is elegant and expressive" # Transcribe audio to text RubyLLM . transcribe "meeting.wav" # Moderate content for safety RubyLLM . moderate "Check if this text is safe" # Let AI use your code class Weather < RubyLLM :: Tool desc "Get current weather" def execute ( latitude :, longitude :) url = "https://api.open-meteo.com/v1/forecast?latitude= #{ latitude } &longitude= #{ longitude } &current=temperature_2m,wind_speed_10m" JSON . parse ( Faraday . get ( url ). body ) end end chat . with_tool ( Weather ). ask "What's the weather in Berlin?" # Define an agent with instructions + tools class WeatherAssistant < RubyLLM :: Agent model "gpt-5-nano" instructions "Be concise and always use tools for weather." tools Weather end WeatherAssistant . new . ask "What's the weather in Berlin?" # Get structured output class ProductSchema < RubyLLM :: Schema string :name number :price array :features do string end end response = chat . with_schema ( ProductSchema ). ask "Analyze this product" , with: "product.txt" Features Chat: Conversational AI with RubyLLM.chat Vision: Analyze images and videos Audio: Transcribe and understand speech with RubyLLM.transcribe Documents: Extract from PDFs, CSVs, JSON, any file type Image generation: Create images with RubyLLM.paint Embeddings: Generate embeddings with RubyLLM.embed Moderation: Content safety with RubyLLM.moderate Tools: Let AI call your Ruby methods Agents: Reusable assistants with RubyLLM::Agent Structured output: JSON schemas that just work Streaming: Real-time responses with blocks Rails: ActiveRecord integration with acts_as_chat Async: Fiber-based concurrency Model registry: 800+ models with capability detection and pricing Extended thinking: Control, view, and persist model deliberation Providers: OpenAI, xAI, Anthropic, Gemini, VertexAI, Bedrock, DeepSeek, Mistral, Ollama, OpenRouter, Perplexity, GPUStack, and any OpenAI-compatible API Installation Add to your Gemfile: gem 'ruby_llm' Then bundle install . Configure your API keys: # config/initializers/ruby_llm.rb RubyLLM . configure do | config | config . openai_api_key = ENV [ 'OPENAI_API_KEY' ] end Rails # Install Rails Integration bin/rails generate ruby_llm:install bin/rails db:migrate bin/rails ruby_llm:load_models # v1.13+ # Add Chat UI (optional) bin/rails generate ruby_llm:chat_ui class Chat < ApplicationRecord acts_as_chat end chat = Chat . create! model: "claude-sonnet-4" chat . ask "What's in this file?" , with: "report.pdf" Visit http://localhost:3000/chats for a ready-to-use chat interface!