brainlid/langchain
Elixir implementation of a LangChain style framework that lets Elixir projects integrate with and leverage LLMs.
What it solves
Elixir LangChain provides a framework for Elixir applications to integrate Large Language Models (LLMs) and connect them to external data sources and application logic. It simplifies the process of "chaining" different services, libraries, and functions together to create data-aware and agentic applications.
How it works
The library uses a modular system of components and pre-built "chains" to manage interactions with LLMs. The central module, LLMChain, coordinates the flow of messages and tool execution. It supports a wide array of providers including OpenAI, Anthropic, Google Gemini, xAI Grok, and local models via Ollama or Bumblebee. A key feature is the LangChain.Function, which allows developers to expose specific Elixir functions as tools that the LLM can call to interact with the application's internal data or perform actions.
Who it’s for
Developers using the Elixir programming language who want to build AI-powered applications, agents, or tools that leverage both cloud-based and self-hosted language models.
Highlights
- Extensive Provider Support: Integrates with numerous services including AWS Bedrock Mantle, Cloudflare Workers AI, DeepSeek, and Mistral.
- Agentic Capabilities: Enables LLMs to interact with their environment through custom Elixir functions.
- Multi-modal Support: Handles messages containing text, images, files, and "thinking" blocks.
- Trajectory Tracking: Includes
LangChain.Trajectoryto capture and evaluate the sequence of tool calls for debugging and performance optimization. - Prompt Caching: Supports prefix-based prompt caching for providers like ChatGPT, Claude, and DeepSeek to reduce costs and latency.
Related
- Project
- Project
- Project
- Project
- Project