Langchainrb provides a Ruby interface for building LLM-powered apps, including RAG/vector search support and a unified LLM API. It has active maintenance with multiple releases up to 2025 and a Ruby/MIT licensed codebase.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
A Ruby gem that offers a unified interface for interacting with various LLM providers and building retrieval augmented generation (RAG) and vector search workflows in Ruby. It includes tooling for embeddings, completions, chat, and a prompt management system, plus support for multiple vector databases.
How it works
The library exposes a Langchain::LLM namespace with providers such as Anthropic, AWS Bedrock, Azure OpenAI, Cohere, Google Gemini/Vertex AI, HuggingFace, Mistral AI, Ollama, OpenAI, and Replicate. LLM objects expose methods for embed, complete, and chat, returning structured response objects. Vector search integration is provided via Langchain::Vectorsearch classes for databases like Chroma, Hnswlib, Milvus, Pinecone, Pgvector, Qdrant, Weaviate, and Elasticsearch. Example usage shows creating an LLM instance with an API key, invoking methods, and parsing structured outputs.
Getting started
Install the gem via Bundler:
bundle add langchainrb
If Bundler is not used:
gem install langchainrb
Usage examples include:
require "langchain"
Initialization pattern for an OpenAI LLM:
llm = Langchain::LLM::OpenAI.new(
api_key: ENV["OPENAI_API_KEY"],
default_options: { temperature: 0.7, chat_model: "gpt-4o" }
)
Embedding, completion, and chat methods are shown with their respective parameters and return handling. The README also documents prompt templates, few-shot prompts, and a structured output parser for JSON schemas, including examples of saving/loading prompts and parsing outputs.
For vector databases, the README demonstrates selecting a database (e.g., Weaviate) and creating a client by passing llm, URL, and index name, along with alternative clients for Chroma, Hnswlib, Milvus, Pinecone, Pgvector, Qdrant, and Elasticsearch. It also shows how to add texts and create a default schema for the vector store.
Recent releases
Latest releases include:
- 0.19.5 (2025-05-01): SECURITY updates bumping rack from 3.1.10 to 3.1.12 and bumping uri from 1.0.2 to 1.0.3.
- 0.19.4 (2025-02-17): Feat to support image URLs in tool outputs; SECURITY bump for googleauth from 1.11.0 onward.
- 0.19.3 (2025-01-13): Default Ollama to use llama3.2; workaround applied for Chroma query.
- 0.19.2 (2024-11-26): Added assistant.tool_execution_callback.
- 0.19.1 (2024-11-21): Updated instructions on creating custom tools and README.
Traction
Stars: 1990 Forks: 262 Open issues: 80
Behind the repo
Not provided in the README or facts.
Caveats
License: MIT Created: 2023-04-18 Last push: 2026-05-01






