Langchain-hs logo

Langchain-hs

Free

Haskell implementation of Haskell. ![GitHub Repo stars](https://img.shields.io/github/stars/tusharad/langchain-hs?style=social)

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About Langchain-hs

LangChain Haskell is a robust port of the original LangChain library, bringing its powerful natural language processing capabilities to the Haskell ecosystem. It enables developers to build applications powered by large language models (LLMs) with ease and flexibility, featuring composable components for LLM integration, prompt templates, memory management, agents and tools, document loaders, text splitters, output parsers, vector stores (with Faiss support), and embeddings. Currently supports Ollama, OpenAI, Huggingface, and OpenAI compatible APIs (LMStudio, OpenRouter, Llama-cpp, Deepseek).

Key Features

LLM Integration with multiple providers: Ollama, OpenAI, Huggingface, OpenAI compatible APIs
Prompt Templates for creating and managing dynamic prompts
Memory Management to maintain conversational context across interactions
Agents and Tools for performing complex tasks
Document Loaders to load and process documents from various sources
Text Splitter for splitting text into smaller chunks
Output Parser for parsing and processing LLM outputs
VectorStore and Retriever for storing and retrieving document embeddings (Faiss support via faiss-hs)
Embeddings component for generating vector representations of text

Pros & Cons

Pros
  • Open source and free to use
  • Composable modular design inspired by LangChain
  • Supports multiple major LLM providers out of the box
  • Built in Haskell, leveraging strong static typing and functional programming
  • Includes vector store integration for similarity search (Faiss)
Cons
  • Relatively small community and limited adoption (52 GitHub stars)
  • Documentation is primarily the README and Hackage API reference
  • Only supports a few LLM providers compared to the Python LangChain
  • Requires familiarity with Haskell for effective use

Best For

Building conversational AI chatbots with memoryCreating document question-answering systemsDeveloping agents that use tools to automate tasksTranslating text between languages (as demonstrated in quickstart)Processing and analyzing large documents by splitting and embedding

FAQ

What is LangChain Haskell?
LangChain Haskell is a port of the LangChain library to Haskell, providing tools for building applications with large language models through composable components.
Which LLM providers are supported?
Currently supported providers include Ollama, OpenAI, Huggingface, and OpenAI compatible APIs (such as LMStudio, OpenRouter, Llama-cpp, and Deepseek).
How do I install LangChain Haskell?
Add 'langchain-hs' to your package dependencies (e.g., in package.yaml) and run your build tool to fetch and compile the dependency.
Is LangChain Haskell free?
Yes, it is open source and free to use under the license provided in the repository.