langchain
0.9.0, released 3 months ago by langchaindart.dev
A Dart/Flutter library for building LLM‑powered applications with LangChain patterns.
What it does
Provides unified APIs for LLM providers, retrieval, agents, and chaining components. Includes core abstractions and higher‑level chains to simplify building chatbots, RAG, and other generative AI use cases.
AI-written summary of version 0.9.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to integrate multiple LLM providers in a Flutter app
- You want a composable, chain‑based architecture for AI features
- You require retrieval‑augmented generation or agent tooling
Skip it when
- You only need a single, lightweight LLM client without extra abstractions
- You prefer a minimal pure‑http wrapper instead of a full framework
Strengths
- Comprehensive LangChain‑style API for Dart
- Modular design lets you import only needed parts
- Supports many providers and retrieval/agent patterns
Weaknesses
- Adds a learning curve compared to simple HTTP clients
- Potentially larger bundle size for full feature set
- Breaking changes between major versions may require migration
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 6
Add the package to pubspec.yaml; optionally include integration packages (e.g., langchain_openai). No special permissions required beyond network access.
import 'package:langchain/langchain.dart';
final llm = OpenAIChatModel(apiKey: 'YOUR_KEY');
final chain = LLMChain(promptTemplate: PromptTemplate.fromTemplate('Summarize: {text}'), llm: llm);
final result = await chain.run({'text': 'Long article content...'});
print(result);Alternatives
Packages that do the same job and could replace langchain.
- llamadart
A lightweight Dart client for LLaMA models, suitable if you only need a single LLM backend
93Compare - firebase_ai
Provides Firebase‑hosted AI services with tighter integration to other Firebase features
86Compare - gpt_markdown
Simpler wrapper focused on OpenAI GPT and markdown generation, less overhead than full LangChain
94Compare
Works with
Packages commonly used together with langchain: ones it builds on, ones built on it, and its own family.
- cryptolangchain depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- uuidlangchain depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- characterslangchain depends on itUnicode and grapheme cluster aware string manipulation operations for Dart.
- langchain_corelangchain depends on itCore abstractions and LangChain Expression Language for LangChain.dart.
- langchain_openaiSame familyLangChain.dart integration module for OpenAI APIs.
- langchain_googleSame familyLangChain.dart integration module for Google AI, Gemini, and VertexAI.