All-in-one Python AI framework for semantic search, RAG, LLM orchestration and language model workflows, built on an embeddings database.
patterns-ai-core/langchainrb
A Ruby library for building LLM-powered applications, offering a unified interface to many LLM providers, vector databases, RAG pipelines and assistants.
- Stars
- 2,008
- Forks
- 270
- Open issues
- 88
- Last commit
- 17 days ago
What is it?
Langchain.rb is a Ruby gem for building applications on top of large language models. It gives Ruby developers one interface to call providers such as OpenAI, Anthropic, Google Gemini, Mistral AI, Ollama and AWS Bedrock, so switching backends mostly means changing the class you instantiate.
The library covers the common building blocks of LLM apps: prompt templates, output parsers that turn model text into structured JSON, and retrieval-augmented generation (RAG) over a range of vector search databases including Chroma, Pinecone, Pgvector, Qdrant, Weaviate, Milvus and Elasticsearch. It can load and index files in formats such as PDF, DOCX, CSV and XLSX.
For agent-style use cases, the Assistant class combines an LLM with tools such as a calculator, SQL database access, web search and a file system tool, and supports custom tools. A RAGAS-based evaluation module scores faithfulness, context relevance and answer relevance of RAG pipelines. Optional gems are required for each integration, so applications only pull in what they use.
Key features
- 01Unified interface for multiple LLM providers, including embeddings, completions and chat
- 02Vector search integrations with eight databases such as Chroma, Qdrant and Pgvector
- 03Prompt templates and output parsers that produce structured JSON with automatic fixing
- 04Assistant class with built-in tools and support for custom tools and streaming
- 05RAG evaluation with RAGAS-style faithfulness and relevance scores
Use cases
- Adding question answering over company documents to a Rails or Ruby app using RAG
- Building a chat assistant that calls tools such as search or a database
- Switching between LLM providers without rewriting application code
- Evaluating the quality of a retrieval pipeline in Ruby
Quick start
- 1
Add the gem to your Gemfile with Bundler
bundle add langchainrb - 2
Or install the gem directly without Bundler
gem install langchainrb - 3
Require the library in your Ruby code
Things to know
- Additional gems may be required beyond the core gem, which is not included by default.
- Most LLM and vector database integrations need provider API keys or separate services.
In collections
Topics
FAQ
- What is langchainrb?
- A Ruby library for building LLM-powered applications, offering a unified interface to many LLM providers, vector databases, RAG pipelines and assistants. Langchain.rb is a Ruby gem for building applications on top of large language models. It gives Ruby developers one interface to call providers such as OpenAI, Anthropic, Google Gemini, Mistral AI, Ollama and AWS Bedrock, so switching backends mostly means changing the class you instantiate.
- Is langchainrb free to use? What license does it have?
- langchainrb is open source under the MIT license. Check the license terms before using it in commercial products.
- Is langchainrb still maintained?
- Actively maintained. The last commit to langchainrb was on Oct 21, 2026.
- What can I use langchainrb for?
- Adding question answering over company documents to a Rails or Ruby app using RAG Building a chat assistant that calls tools such as search or a database Switching between LLM providers without rewriting application code Evaluating the quality of a retrieval pipeline in Ruby
- How do I install langchainrb?
- Add the gem to your Gemfile with Bundler: bundle add langchainrb Or install the gem directly without Bundler: gem install langchainrb Require the library in your Ruby code
- Where can I get langchainrb?
- The source code and installation instructions are on GitHub: https://github.com/patterns-ai-core/langchainrb
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A step-by-step educational project that builds Retrieval-Augmented Generation from scratch in JavaScript using local LLMs and no cloud APIs.
Builds machine learning models from a natural-language intent and a tabular dataset using a multi-agent workflow.
A Rust library for local-first AI agent memory that filters low-value content at ingest and offers configurable retrieval over Markdown-backed storage.
Open-source embedding database for AI apps, storing documents and vectors to power semantic, hybrid and full-text search.
A free, open-source 10-week online course on building LLM applications with RAG, vector search, agents, evaluation and monitoring.