LangchainRb logo

LangchainRb

Free

Ruby Langchain ![GitHub Repo stars](https://img.shields.io/github/stars/andreibondarev/langchainrb?style=social)

FreeFree tier
Inputs: text
Type
Open Source
Company
patterns-ai-core

About LangchainRb

Langchain.rb is a Ruby gem that provides a unified interface for building LLM-powered applications. It supports multiple large language model providers including Anthropic, AWS Bedrock, Azure OpenAI, Cohere, Google Gemini, Google Vertex AI, HuggingFace, Mistral AI, Ollama, OpenAI, and Replicate. Key capabilities include generating embeddings, prompt completions, and chat completions, along with prompt management, output parsing, Retrieval Augmented Generation (RAG), vector search, assistants (chat bots), evaluations, and logging. The gem is designed to integrate seamlessly with Rails through the companion langchainrb_rails gem.

Key Features

Unified interface for multiple LLM providers (Anthropic, AWS Bedrock, Azure OpenAI, Cohere, Google Gemini, Google Vertex AI, HuggingFace, Mistral AI, Ollama, OpenAI, Replicate)
Generating embeddings for text
Generating prompt completions and chat completions
Retrieval Augmented Generation (RAG) and vector search
Assistants (chat bots) support
Prompt management and output parsing
Evaluations and logging capabilities
Deep Rails integration via langchainrb_rails gem

Pros & Cons

Pros
  • Abstracts away differences between LLM providers, allowing easy switching
  • Rich set of supported providers and models
  • Open source and free to use
  • Designed for Ruby ecosystem with Rails integration
  • Includes RAG, vector search, and evaluation tools
Cons
  • Requires additional gems to be installed for specific providers
  • Primarily focused on Ruby, limiting adoption outside that ecosystem
  • Community size and documentation may be smaller compared to Python-based alternatives

Best For

Building RAG systems with vector searchCreating conversational chatbots and virtual assistantsPerforming semantic search via embeddingsAutomating text generation and completion tasksDeveloping multi-provider LLM applications in Ruby

FAQ

How do I install Langchain.rb?
Install the gem by adding `gem 'langchainrb'` to your Gemfile and running `bundle install`, or via `gem install langchainrb`.
Which LLM providers are supported?
Langchain.rb supports Anthropic, AWS Bedrock, Azure OpenAI, Cohere, Google Gemini, Google Vertex AI, HuggingFace, Mistral AI, Ollama, OpenAI, and Replicate.
Can Langchain.rb be used with Ruby on Rails?
Yes, there is a dedicated `langchainrb_rails` gem that provides deep Rails integration.