Langchain.rb
A Ruby framework for building LLM-powered applications, providing a unified interface across providers such as Anthropic, AWS Bedrock, Google Gemini and OpenAI for embeddings, prompt completions, chat and retrieval-augmented generation.
Langchain.rb is a Ruby framework for building applications powered by large language models, covering use cases such as retrieval-augmented generation with vector search and chat-bot style assistants. Its LLM classes all inherit from a common base and expose a consistent interface for generating embeddings, prompt completions and chat completions, so switching between supported providers, including Anthropic, AWS Bedrock, Azure OpenAI, Cohere, Google Gemini, Google Vertex AI, Hugging Face, Mistral AI, Ollama, OpenAI and Replicate, needs minimal code changes.
Beyond the unified LLM interface, it provides prompt management helpers, output parsers for structuring model responses, tools for building retrieval-augmented generation pipelines, an assistants abstraction for chat-bot-style applications, and evaluation utilities. A companion gem, langchainrb_rails, adds deeper integration for Ruby on Rails applications.
It installs as a Ruby gem through Bundler or directly, and is released under the MIT license.