{"data":{"slug":"davidmigloz-langchain-dart","name":"langchain_dart","tagline":"Build LLM-powered Dart/Flutter applications.","github_url":"https://github.com/davidmigloz/langchain_dart","owner":"davidmigloz","repo":"langchain_dart","owner_avatar_url":"https://avatars.githubusercontent.com/u/6546265?v=4","primary_language":"Dart","stars":685,"forks":154,"topics":["ai","dart","flutter","generative-ai","llms","nlp"],"archived":false,"github_pushed_at":"2026-08-03T00:07:20+00:00","maintenance_label":"Very active","url":"https://www.graphcanon.com/tools/davidmigloz-langchain-dart","markdown_url":"https://www.graphcanon.com/tools/davidmigloz-langchain-dart.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/davidmigloz-langchain-dart","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=davidmigloz-langchain-dart","description":"Build LLM-powered Dart/Flutter applications.","homepage_url":"http://davidmigloz.github.io/langchain_dart/","license":"MIT","open_issues":20,"watchers":15,"ai_summary":"LangChain.dart provides a unified interface for calling different Language Models (LLMs) and enables chaining multiple components to implement complex use cases, such as RAG pipelines in Dart/Flutter applications.","readme_excerpt":"## Getting started\n\nTo start using LangChain.dart, add `langchain` as a dependency to your `pubspec.yaml` file. Also, include the dependencies for the specific integrations you want to use (e.g.`langchain_community`, `langchain_openai`, `langchain_google`, etc.):\n\n```yaml\ndependencies:\n  langchain: {version}\n  langchain_community: {version}\n  langchain_openai: {version}\n  langchain_google: {version}\n  ...\n```\n\nThe most basic building block of LangChain.dart is calling an LLM on some prompt. LangChain.dart provides a unified interface for calling different LLMs. For example, we can use `ChatGoogleGenerativeAI` to call Google's Gemini model:\n\n```dart\nfinal model = ChatGoogleGenerativeAI(apiKey: googleApiKey);\nfinal prompt = PromptValue.string('Hello world!');\nfinal result = await model.invoke(prompt);\n// Hello everyone! I'm new here and excited to be part of this community.\n```\n\nBut the power of LangChain.dart comes from chaining together multiple components to implement complex use cases. For example, a RAG (Retrieval-Augmented Generation) pipeline that would accept a user query, retrieve relevant documents from a vector store, format them using prompt templates, invoke the model, and parse the output:\n\n```dart\n// 1. Create a vector store and add documents to it\nfinal vectorStore = MemoryVectorStore(\n  embeddings: OpenAIEmbeddings(apiKey: openaiApiKey),\n);\nawait vectorStore.addDocuments(\n  documents: [\n    Document(pageContent: 'LangChain was created by Harrison'),\n    Document(pageContent: 'David ported LangChain to Dart in LangChain.dart'),\n  ],\n);\n\n// 2. Define the retrieval chain\nfinal retriever = vectorStore.asRetriever();\nfinal setupAndRetrieval = Runnable.fromMap<String>({\n  'context': retriever.pipe(\n    Runnable.mapInput((docs) => docs.map((d) => d.pageContent).join('\\n')),\n  ),\n  'question': Runnable.passthrough(),\n});\n\n// 3. Construct a RAG prompt template\nfinal promptTemplate = ChatPromptTemplate.fromTemplates([\n  (ChatMessageType.system, 'Answer the question based on only the following context:\\n{context}'),\n  (ChatMessageType.human, '{question}'),\n]);\n\n// 4. Define the final chain\nfinal model = ChatOpenAI(apiKey: openaiApiKey);\nconst outputParser = StringOutputParser<ChatResult>();\nfinal chain = setupAndRetrieval\n    .pipe(promptTemplate)\n    .pipe(model)\n    .pipe(outputParser);\n\n// 5. Run the pipeline\nfinal res = await chain.invoke('Who created LangChain.dart?');\nprint(res);\n// David created LangChain.dart\n```\n\n---\n\n## License\n\nLangChain.dart is licensed under the [MIT License](https://github.com/davidmigloz/langchain_dart/blob/main/LICENSE).","github_created_at":"2023-06-03T14:38:25+00:00","created_at":"2026-07-11T10:43:27.333601+00:00","updated_at":"2026-08-08T06:03:14.11875+00:00","categories":[{"slug":"data-retrieval","name":"Data & Retrieval","url":"https://www.graphcanon.com/categories/data-retrieval","markdown_url":"https://www.graphcanon.com/categories/data-retrieval.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/data-retrieval"},{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"}],"tags":[{"slug":"ai","name":"ai"},{"slug":"dart","name":"dart"},{"slug":"flutter","name":"flutter"},{"slug":"generative-ai","name":"generative-ai"},{"slug":"llms","name":"llms"},{"slug":"nlp","name":"nlp"}],"trust":{"provenance":{"is_fork":false,"github_id":649025519,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-08T06:03:13.439Z","maintenance":{"label":"Very active","score":96,"methodology":"github_public_v1","releases_90d":0,"days_since_push":5,"last_release_at":"2025-12-27T16:53:00Z"},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T10:43:28.820Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-08T06:03:13.874Z"},"languages":{"value":["dart"],"source":"github.language","observed_at":"2026-08-08T06:03:13.874Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-08-08T06:03:13.874Z"}},"decision_facts":{"hosting":null,"pricing":{"model":"freemium","summary":"Freely available for use and licensed under MIT. No explicit service-level pricing is outlined beyond potential costs from using integrated third-party models or services."},"requirements":null,"constraints":{"pricing_model":"freemium"},"when_to_use":["You are developing Dart or Flutter applications that require integration with various Language Models (LLMs) without rewriting extensive connectivity code.","Your application demands complex use cases such as implementing a Retrieval-Augmented Generation (RAG) pipeline, where you need to retrieve relevant documents and combine them with model responses.","There is a requirement for easy integration of specific providers' LLMs like Google's Gemini model or OpenAI models into your Dart/Flutter app."],"when_not_to_use":["Your application does not require the chaining of multiple components or complex use cases such as RAG pipelines and can function with direct, simple API calls to language models.","You are looking for a framework that supports languages other than Dart; LangChain.dart is specifically designed for Dart/Flutter applications only.","You have specific requirements or constraints around licensing that do not align with the MIT License under which LangChain.dart is released."],"source":"enrich:decision_facts","observed_at":"2026-07-12T15:11:25.328Z"},"constraint_facets":{"pricing_model":"freemium"},"decision_summary":[{"label":"Pricing","value":"freemium - Freely available for use and licensed under MIT. No explicit service-level pricing is outlined beyond potential costs from using integrated third-party models or services."},{"label":"Adopt for","value":"Unveils capabilities for LLM-powered Dart/Flutter applications with a focus on component chaining and RAG pipelines."},{"label":"License detail","value":"LangChain.dart operates under the permissive MIT License, allowing free use and modification as long as copyright and license information are preserved."}]}}