qmetrics.net

Langchain.rb

Ruby gem for LLM apps, RAG, and assistants

Langchain.rb screenshot

A Ruby library for retrieval-augmented generation, unified LLM APIs, prompt templates, and tool-using assistants.

Overview

Langchain.rb helps Ruby developers build LLM-powered features inside their applications. It focuses on practical patterns such as retrieval augmented generation, chat assistants, and structured outputs rather than shipping a standalone service.

The Langchain::LLM namespace offers a shared interface across providers including Anthropic, OpenAI, Google Gemini and Vertex AI, AWS Bedrock, Azure OpenAI, Cohere, Mistral, Ollama, HuggingFace, and Replicate, with embed, complete, and chat operations and consistent response objects. Prompt templates, few-shot templates, and output parsers turn model text into JSON or fixed schemas, with helpers to repair invalid JSON.

RAG workflows connect to multiple vector search backends through one interface, supporting indexing plain text or parsed files in formats such as PDF, HTML, DOCX, and CSV. The Langchain::Assistant class combines an LLM with built-in or custom tools, conversation state, and optional callbacks for tool execution.

Evaluation helpers include RAGAS-style faithfulness and relevance metrics. A separate langchainrb_rails gem is noted for deeper Rails integration. The core package is installed as a Ruby gem and imported from application code.

Key features

  • Unified LLM provider interface
  • Prompt and few-shot templates
  • Structured output parsers
  • Vector search database adapters
  • RAG indexing and retrieval
  • Assistant with tool calling
  • Built-in tools such as calculator and search
  • RAGAS evaluation metrics

Use cases

  • RAG question answering in Ruby apps
  • Chat assistants with tools
  • Switching between LLM vendors
  • Parsing LLM output to JSON

Tags

Similar software

Graphify

Codebase knowledge graph skill for AI coding assistants

Graphify maps a project’s code, docs, and media into a queryable local knowledge graph and installs as a skill for assistants such as Cursor and Claude Code.

★ 154.2k⟳ yesterdayApache-2.0

Headroom

Local LLM context compression library and proxy

Headroom shrinks tool outputs, logs, JSON, and chat history before LLM calls to cut input tokens while preserving retrievable originals. It offers a Python library, proxy, MCP tools, and agent wrappers.

★ 81k⟳ yesterdayApache-2.0

PageIndex

Reasoning-based document retrieval without vector indexes

PageIndex builds a hierarchical tree index from PDFs and answers questions by having a language model reason over that structure instead of embedding chunks in a vector database.

★ 40.8k⟳ 2 days agoMIT

LangExtract

LLM-driven structured extraction with source grounding

LangExtract is a Python library that pulls structured entities from unstructured text using LLMs, with chunking for long documents and HTML review output.

★ 39.4k⟳ yesterdayApache-2.0

MCP for Blender

Model Context Protocol bridge for LLM-driven Blender control

A third-party integration pairing a Blender addon with an MCP server so AI clients can manipulate scenes, materials, and scripts in Blender 3.0+ on your machine.

★ 36k⟳ yesterdayMIT

Composio

SDK and CLI for connecting AI agents to many apps

Composio equips AI agents with large sets of pre-authenticated toolkits, per-user sessions, authentication, triggers, and a sandbox. SDKs ship for TypeScript and Python with adapters for common agent frameworks.

★ 31.3k⟳ todayMIT