Raif Logo

Raif - a Ruby AI Framework

A Rails engine for adding AI-powered features to Rails applications.

Get started now View it on GitHub


Overview

Raif is a Ruby on Rails engine for adding AI-powered features to Rails applications. This allows Raif to provide a full MVC stack for working with LLMs.

Key Features

  • Tasks - Single-shot AI operations for organizing LLM prompts
  • Conversations - Full-stack LLM chat interfaces, including multi-turn chat history preservation and streaming support.
  • Agents - ReAct-style agents that can use tools in loops
  • Custom Model Tools - Custom tools that tasks/conversations/agents can invoke to interact with external systems
  • Provider-Managed Tools - Support for tools that are managed by the LLM provider, such as web search, code execution, and image generation.
  • Multiple LLM Providers Adapters - OpenAI, Anthropic Claude, AWS Bedrock, OpenRouter
  • Built-in Response Format Handling - Support for structured outputs including JSON responses, schemas, & parsing. HTML response handling and sanitization.
  • Image & PDF Support - Support for including images and PDF in prompts.
  • Web Admin Interface - A web interface for viewing and managing all LLM interactions.

About the Project

Raif and its core concepts were extracted from ARC Analysis, an AI-driven research & analysis platform built by Cultivate Labs.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/CultivateLabs/raif.

License

The gem is available as open source under the terms of the MIT License.