Semantic Kernel vs LangChain

February 20, 2024 · View on GitHub

The repo tries to compare Semantic Kernel and LangChain to show the difference and similarity between them.

LangChainSemantic KernelNote
ChainsKernelConstruct sequences of calls
AgentsPlannerAuto create chains to address novel needs for a user
ToolsPlugins (semantic functions + native function)Custom components that can be reused across different apps
MemoryMemoryStore context and embeddings in memory or other storage

Initial Release Date

LangChain: Oct, 2022

Semantic Kernel: Mar, 2023

Some Numbers

Semantic Kernel: Github Stars NuGet Pip Downloads GitHub contributors

LangChain: Github Stars Downloads GitHub contributors

Supported languages

LanguageLangChainSemantic Kernel
Python
JavaScript
C#
Java

Data connection (Retrieval)

Many LLM applications require user-specific data that is not part of the model's training set. The primary way of accomplishing this is through Retrieval Augmented Generation (RAG). In this process, external data is retrieved and then passed to the LLM when doing the generation step.

Data connection

Building blockLangChainSemantic Kernel
Document loaders: Load documents from many different sourcesOver 100 document loaders: File Loaders (CSV, Docx, EPUB, JSON, PDF, Markdown...) and Web Loaders (Azure Storage, S3, GitHub, Figma...)Word
Document transformers: Split documents, drop redundant documents, and moreMultiple Split methods
Text embedding models: Take unstructured text and turn it into a list of floating point numbersOver 25 different embedding providers: OpenAI, Azure OpenAI, Hugging Face, Cohere, Google PaLM, Google Vertex AI, TensorFlow...OpenAI, Azure OpenAI, Hugging Face
Vector stores: Store and search over embedded dataOver 50 vector storesAbout 10 vector stores
Retrievers: Query your dataSimple semantic search, Contextual compression, Time-weighted vector store retriever, Parent Document Retriever, Self Query Retriever, Ensemble Retriever, and more.Simple semantic search

Automatically orchestrate AI

TypeLangChain's AgentsSemantic Kernel's Planner
Conversational
Plan and execute✅ (SequentialPlanner)
ReAct✅ (StepwisePlanner)
Tree of Thoughts (ToT)