brainlid/langchain

Elixir implementation of a LangChain style framework that lets Elixir projects integrate with and leverage LLMs.

What it solves

Large Language Models (LLMs) are most powerful when combined with external data or computation. This library solves the difficulty of integrating LLMs into Elixir applications by providing a structured way to connect models to other services, data sources, and application logic.

How it works

The library uses modular components and pre-built chains to manage interactions with LLMs. It supports a wide range of providers—including OpenAI, Anthropic, Google Gemini, and local models via Ollama or Bumblebee—and allows developers to expose custom Elixir functions as tools for the LLM to use. It also includes a trajectory system to capture and evaluate the sequence of tool calls made by an agent.

Who it’s for

Elixir developers looking to build sophisticated AI-powered applications, such as data-aware chatbots or autonomous agents, that require integration with various third-party APIs or local machine learning models.

Highlights

  • Extensive Model Support: Integrates with major providers like OpenAI, Anthropic, Google, and xAI, as well as local hosting via Bumblebee.
  • Agentic Capabilities: Enables LLMs to interact with application code through a specialized Function bridge.
  • Modular Design: Offers both low-level components for custom logic and high-level, off-the-shelf chains for rapid development.
  • Agent Evaluation: Includes LangChain.Trajectory to capture, match, and test the reasoning paths and tool-calling sequences of agents.