Skip to content
CAI
Software that uses CAICheck a score

patterns-ai-core/langchainrb

66.0

Adequate · 21 October 2026

8.6k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a Ruby gem that provides a modular framework for building applications powered by Large Language Models. It unifies interactions with diverse LLM providers through a consistent interface, supporting features like chat, streaming, and tool use. The library also enables Retrieval-Augmented Generation (RAG) by integrating with multiple vector search backends and offers utilities for document processing, prompt management, and agent tool execution.

How it got here

2023 — Initial release and modular architecture

19 changes.

This period marks the initial public release of the Langchain Ruby gem, establishing a modular architecture with a unified Langchain namespace. It introduces core abstractions for LLM interactions, vector search, and agent tools, alongside comprehensive file processing and structured output parsing capabilities.

2024–2025 — Rails engine migration and test expansion

17 changes.

The project restructured as a Rails Engine and introduced a unified parameter schema with provider-specific adapters for the Assistant tool use. This architectural shift was accompanied by the addition of a Rails dummy app and comprehensive RSpec test suites covering core components, LLM integrations, and vector search backends.

Features

Add RAGAS evaluation framework for RAG pipelines

Users can now evaluate Retrieval Augmented Generation (RAG) pipelines using the RAGAS framework. This adds a new \Langchain::Evals::Ragas::Main\ class that computes an overall RAGAS score along with three sub-metrics: answer relevance, context relevance, and faithfulness. The implementation includes the necessary logic classes and prompt templates to assess how well generated answers align with questions, how focused the retrieved context is, and whether the answers are grounded in that context.

lib/langchain/evals · high confidence

Initial project scaffolding and configuration

The repository is initialized with essential configuration files, including a \.env.example\ template listing required API keys for supported providers (e.g., OpenAI, Anthropic, Ollama), a \.gitignore\ to exclude build artifacts and secrets, and development tooling configurations such as \.rubocop.yml\, \.standard.yml\, and \lefthook.yml\ for linting and pre-commit hooks. A comprehensive \README.md\ is added to document installation, usage, and supported LLM providers, alongside a \CHANGELOG.md\ to track version history.

(repo-wide) · high confidence

Initial release of Langchain Ruby gem v0.19.5

This change introduces the initial public release of the Langchain Ruby gem (version 0.19.5). It provides a new \Langchain::Assistant\ class for managing LLM interactions, tool definitions, and conversation state, alongside a \Langchain::Loader\ for loading and processing data from files and URLs. The release also includes core abstractions such as \Langchain::Data\ and \Langchain::Chunk\ for handling document data, a \Langchain::ToolResponse\ for standardized tool outputs, and a \Langchain::Engine\ for Rails integration.

lib/langchain · high confidence

Introduce Langchain::Vectorsearch with multi-provider RAG support

Users can now perform vector-based similarity search and Retrieval-Augmented Generation (RAG) across six supported providers: Chroma, Elasticsearch, Milvus, Pinecone, Qdrant, and Weaviate. Each provider class implements a consistent interface for managing indexes (create, destroy, update), adding/removing/updating text chunks, and searching by query or embedding. The new \ask\ method on each provider enables end-to-end RAG workflows by automatically retrieving relevant context and passing it to an LLM, with support for streaming responses. Additionally, HyDE-style search is available via a dedicated prompt template.

lib/langchain/vectorsearch · high confidence

Introduce chunker base class and semantic chunking prompt

Added a base class for chunkers in the Langchain library to standardize how documents are split into smaller chunks for vector search, preventing context window limits. Included a new semantic chunker prompt template that instructs the system to split text by topics, outputting paragraphs delimited by '---'.

lib/langchain/chunker · high confidence

Introduce structured LLM response objects

The library now wraps raw API payloads in a standardized \Langchain::LLM::Response\ hierarchy, providing a consistent interface for accessing completion text, token usage, and tool calls across providers. This change introduces specific response classes for AI21, Anthropic, AWS Bedrock (Anthropic and Meta), AWS Titan, Cohere, Google Gemini, Hugging Face, Llama.cpp, Mistral AI, Ollama, OpenAI, and Replicate. Users benefit from unified methods like \completion\, \chat\_completion\, \tool\_calls\, and token counters, with provider-specific logic handling differences such as Anthropic's thinking blocks, Gemini's function call parsing, and Cohere's v1/v2 API variations.

lib/langchain/llm/response · high confidence

Introduce structured output parsing with retry logic

The library now includes a base class for output parsers and a dedicated exception class to handle parsing errors. A new \OutputFixingParser\ allows wrapping existing parsers to automatically retry LLM calls when the output is invalid, using a provided prompt template to guide the correction. Additionally, a \StructuredOutputParser\ is available to enforce JSON schema compliance on LLM responses, ensuring outputs match specified formats.

_lib/langchain/output\parsers · high confidence

Introduce unified chat parameters with OpenAI store and Ollama options support

A new \Langchain::LLM::Parameters::Chat\ class has been added to standardize chat-related parameters across LLM providers. This change introduces a unified parameter schema that explicitly supports the OpenAI \store\ parameter for message storage and Ollama-specific \options\. It also includes definitions for standard chat parameters such as \parallel\_tool\_calls\, \tools\, \tool\_choice\, and various sampling controls like \temperature\ and \top\_p\, delegating validation and handling to a new \UnifiedParameters\ class.

lib/langchain/llm/parameters · high confidence

Langchainrb v0.5.0 introduces a modular architecture with new chunkers, LLMs, and tools

This release restructures the library into a modular architecture, moving core components like LLMs, vector search, and tools under the \Langchain\ namespace. It introduces a new \Langchain::Chunker\ module with specialized chunkers for Markdown, recursive text, semantic (LLM-powered), and sentence-based splitting. New LLM integrations include AWS Bedrock (with streaming support) and Google Gemini/Vertex AI. The \Langchain::Tool\ module now provides Database, Google Search, and Vectorsearch tools for agent use. Additionally, the \Langchain::Prompt::PromptTemplate\ format method has been updated to handle nested JSON and escaped braces in a single pass, and the \OutputFixingParser\ now uses \chat\ with messages for error recovery.

langchainrb · high confidence

New built-in tools for agents: Calculator, Code Interpreter, File System, News, Search, Weather, and Wikipedia

Agents can now use a suite of new built-in tools to perform external actions and retrieve information. The \Calculator\ tool evaluates math expressions using the \eqn\ gem, while the \RubyCodeInterpreter\ executes Ruby code in a sandboxed environment via \safe\_ruby\. File operations are handled by the \FileSystem\ tool (list, read, write). External data retrieval is supported by \NewsRetriever\ (NewsAPI), \Tavily\ (LLM-optimized search), \Weather\ (OpenWeatherMap), and \Wikipedia\ (wikipedia-client). Each tool is defined with specific function signatures and dependencies, allowing assistants to seamlessly integrate these capabilities into their workflows.

lib/langchain/tool · high confidence

New examples for assistants, prompt templates, and vector search integrations

Added a suite of new example scripts in the \examples/\ directory demonstrating key Langchain capabilities. These include an interactive assistant chat example (\assistant\_chat.rb\) using OpenAI and weather tools, scripts for creating and managing prompt templates with few-shot and structured JSON output parsing, and an Ollama image inquiry example. Additionally, new vector search examples were added for Chroma, Milvus, Pgvector (with metadata filtering), Pinecone, Qdrant, and Weaviate, showing how to store, query, and interact with documents using these backends.

examples · high confidence

New file-format processors for structured and document data

The library now includes a set of new processors under the Langchain::Processors namespace to parse various file formats into text or structured data. Users can now process CSV files (with configurable row or file chunking), Excel spreadsheets (.xls and .xlsx via the Roo library), Word documents (.docx), PowerPoint presentations (.pptx), PDFs, HTML pages, JSON, JSONL, Markdown, and plain text. Additionally, email files (.eml) are supported, with the processor extracting headers, body text, and handling embedded emails. Each processor handles its specific dependencies (e.g., nokogiri for HTML, pdf-reader for PDFs) and provides a consistent interface for loading and parsing content.

lib/langchain/processors · high confidence

New utility classes for vector similarity, image handling, and data transformation

Added four new utility classes to the library: \CosineSimilarity\ for calculating the similarity between two numeric vectors, \ImageWrapper\ for fetching remote images via HTTP/HTTPS and converting them to Base64 (including a fix to use \URI.parse\ instead of the insecure \URI.open\), \HashTransformer\ for recursively symbolizing hash keys, and \ToBoolean\ for converting various input types into boolean values.

lib/langchain/utils · high confidence

Prompt templates can now be saved to and loaded from JSON or YAML files

Users can persist prompt configurations to disk and reload them later. The \Base\ class now includes a \save\ method that writes prompts to \.json\ or \.yaml\ files, and the \Loading\ module provides a \load\_from\_path\ class method to reconstruct \PromptTemplate\ and \FewShotPromptTemplate\ instances from these files. This enables version control of prompts and easier sharing of configurations across environments.

lib/langchain/prompt · high confidence

Behavioural changes

Introduce LLM adapter layer for Assistant tool use

The Assistant now uses a dedicated adapter pattern to handle LLM-specific requirements for tool use, ensuring correct parameter formatting and behavior across providers. This change introduces adapters for Anthropic, AWS Bedrock Anthropic, Google Gemini, Mistral AI, Ollama, and OpenAI, each implementing the base contract for building chat parameters, messages, and extracting tool call arguments. Key behavioral updates include supporting parallel tool calls for Anthropic and OpenAI (with warnings for unsupported providers like Gemini and Mistral), handling tool\_choice variations (e.g., 'none' as a string for OpenAI/Mistral, specific configs for Gemini), and preserving Anthropic thinking blocks in the conversation loop. The adapter also manages system message support and tool role definitions per provider, allowing the Assistant to correctly route and format tool interactions for each LLM.

lib/langchain/assistant/llm · high confidence

Introduce Langchain.rb as the primary entry point

The library now uses \lib/langchain.rb\ as the main entry point, replacing the previous \lib/langchainrb.rb\. The new entry point initializes the \Langchain\ module, sets up a root path, and configures a logger with colored output for different severity levels. The old \langchainrb.rb\ file now simply requires the new \langchain\ module, ensuring backward compatibility for existing users while establishing a cleaner namespace structure.

lib · high confidence

Introduce provider-specific message classes for Anthropic, Gemini, Mistral, Ollama, and OpenAI

The assistant's message handling has been refactored to use dedicated message classes for each supported provider (Anthropic, Google Gemini, MistralAI, Ollama, and OpenAI), all inheriting from a new \Base\ message class. This change ensures that messages are correctly serialized into the specific API formats required by each provider, including proper handling of roles, tool calls, and multimodal content. Specifically, Anthropic messages now support image attachments and thinking blocks, while Gemini messages correctly format parallel tool responses. Ollama messages now support image URLs with validation compatible with Ruby 3.4+, and OpenAI/Mistral messages properly structure text and image content for their respective APIs.

lib/langchain/assistant/messages · high confidence

LLM provider classes restructured and deprecated

The \lib/langchain/llm\ files have been reorganized into a new modular structure where each provider (e.g., \OpenAI\, \Anthropic\, \Ollama\, \Cohere\, \Azure\, \HuggingFace\, \Replicate\, \MistralAI\) is now a distinct class inheriting from a common \Base\ class. This change introduces a unified \chat\ interface across providers, standardizes default options (such as \chat\_model\ and \embedding\_model\), and adds support for new capabilities like streaming and tool calls. Additionally, the \Langchain::LLM::AI21\ and \Langchain::LLM::LlamaCpp\ classes are now marked as deprecated in favor of other providers.

lib/langchain/llm · high confidence

Rails Engine scaffolding and configuration

The library is now structured as a Rails Engine, introducing standard Rails entry points (\bin/rails\, \bin/rubocop\), an empty route set, and a Rake task file to support integration. Additionally, English inflection rules are configured to correctly handle acronyms for major AI providers and formats, including OpenAI, MistralAI, GoogleVertexAI, AI21, LLM, JSON, and PDF.

bin, config, lib/tasks · high confidence

Test coverage

Added comprehensive test suite for Langchain::Assistant; Added test coverage for LLM response parsers; Added test coverage for Langchain chunkers and Ragas evals; Added test coverage for Langchain core components; Added test coverage for Langchain tools; Added test coverage for Langchain vector search backends; Added test coverage for file processors; Added test coverage for multiple LLM providers; Added test coverage for prompt template functionality; Added test fixtures for CSV, HTML, JSON, JSONL, Markdown, SWF, TXT, EML, and text samples; Added test fixtures for loader data formats; Added test suite and Rails dummy app for the Langchain::Engine; Added test suite for core library components; Added test support infrastructure for HTTP mocking and custom assertions; Added tests for LLM adapter tool choice and parameter handling; Added tests for Langchain output parsers; Added unit tests for assistant message serialization across multiple LLM providers.

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 66.

Lenses

  • Code Health 65
  • Architecture 87
  • Maturity 55
  • Readiness 80
  • Security 94
  • Domain Modelling 100

Changes since last survey

  • 300 commits — 256 feature/other, 44 fixes

By area

  • (root) — 148 commits
  • lib/langchain — 126 commits
  • (repo) — 6 commits
  • spec/fixtures — 6 commits
  • spec/langchain — 6 commits
  • spec/lib — 3 commits
  • .github/dependabot.yml — 2 commits
  • .github/ISSUE_TEMPLATE — 1 commit
  • examples/store_and_query_with_pgvector_using_metadata.rb — 1 commit
  • lib/langchainrb.rb — 1 commit

Notable commits

  • fix: Add Assistant#add_messages() method and fix Assistant#messages= method (#731)
  • fix: Add regression coverage for an explicit tool_calls: null (#1011)
  • fix: Assistant fixes (#780)
  • fix: Fix Chroma#remove_texts method (#670)
  • fix: Fix Gemini parallel tool response formatting (#1047)
  • fix: Fix Langchain::Assistant when llm is Anthropic (#724)
  • fix: Fix Langchain::Assistant::LLM::Adapters::Ollama class (#715)
  • fix: Fix Langchain::Tool::Database#describe_table method (#814)
  • fix: Fix Langchain::Vectorsearch::Milvus initializer by passing :api_key (#939)
  • fix: Fix MistralAIMessage to handle "Tool" Output (#850)
  • fix: Fix News Retriever non-UTF-8 characters (#671)
  • fix: Fix NewsRetriever tool (#625)
  • fix: Fix NoMethodError when Elasticsearch client returns a plain Hash (#1043)
  • fix: Fix OpenAI#embed when text-embedding-ada-002 is used (#741)
  • fix: Fix GoogleGemini#chat method (#723)
  • fix: Fix annonymous block issue (#757)
  • fix: Fix annonymous block issue (#759)
  • fix: Fix broken star history chart in README
  • fix: Fix default embedding dimension for Langchain::LLM::Ollama using llama3.2 (#984)
  • fix: Fix for Ollama Assistant that does not use tools (#707)
  • …and 280 more

Architecture

  • 0 containers · 1 bounded contexts · 0 dependency edges (baseline)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

patterns-ai-core/langchainrb was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 21 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 37f94b7f47a740fc0e21389be454c6dffaeea9fc — the exact code this score is about.
  • Scored under rubric-2026.10.5 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer measure-2026.10.1+preprod-05382052455d.