LangChain is Great, but Only for Prototyping
“LangChain is not meant for production,” declared Praveer Kochhar, the co-founder of Kogo Tech Lab, during Cypher 2024. He was responding to a query regarding optimising infrastructure using LangChain. KissanAI founder Pratik Desai went a step ahead when he wrote on X that “if your developer proposes LangChain for production use, fire them”. That was a bold statement, but there are multiple reasons why no one wants to use LangChain for more than prototyping. The primary reason is LangChain’s overly complex and unnecessary abstractions. Krystian Safjan, AI/ML implementation manager at Ernst & Young Global Consulting Services, mentioned that these layers of abstractions can lead to confusion, especially for those who are new to LLMs or LangChain itself. The complexity can also make it challenging to adapt the library to specific use cases or integrate it with existing tools and scripts. Some developers even call it hype and suggest that even if the code design is made right, we might not need tools like LangSmith at all. Complexity and Instability Many developers have reported that LangChain has a fundamentally flawed design. One frustrated developer on Reddit mentioned that the framework is overly complicated and prone to errors. “I broke my head trying to get the document loader dependencies working to parse a PDF from a folder. Everything blows up. It’s a convoluted mess and a black box. I just avoid it,” he added further. Octomind, a software company, wrote a detailed blog suggesting why they dropped using LangChain. The framework’s inflexibility made it difficult to improve lower-level behaviour, and its intentional abstraction of details hindered writing lower-level code. The Octomind team found that the rapidly changing nature of AI and LLMs made it challenging for LangChain to design abstractions that would stand the test of time. Apparently, LangChain is known to introduce unnecessary complexity by using abstractions on top of other abstractions, making it hard to understand and debug. Angelina Y, the co-founder of OSCR AI, said that as time passes, more people realise that frameworks like LangChain and LlamaIndex are not good for production. “Practically becoming a versatile tool of no use! Of course, I must say that they are very good for making prototypes, especially LlamaIndex,” she added further. Even developers who tried using LangChain found issues related to flexibility. A Reddit user mentioned that he had built apps using LangChain and the overall experience was frustrating, especially when he tried adding custom functions. He ended up ripping out every LangChain component and replacing it with native Python code. “LangChain is a good tool to learn about LLM development patterns,” he added, further suggesting that LangChain is a good option but only when one wants to learn about LLM development and not for scalability. Devs Find LlamaIndex More Useful LlamaIndex is a more search-centric alternative to LangChain, providing a simple interface for querying LLMs and retrieving relevant documents. It is more efficient and less complicated to use, making it a better choice for applications that need to process large amounts of data. When we consider production environments, clients are preferring LlamaIndex over LangChain. A Reddit user mentioned that most of his production clients prefer LlamaIndex. “Though we only support LangChain right now we are seeing the urgency to support LlamaIndex,” he added further. If you are building a general-purpose application that needs to be flexible and extensible, then LangChain is a good choice. Zahir Shaikh, GenAI lead from T-Systems mentioned in his LinkedIn post that if you are building a search and retrieval application that needs to be efficient and simple, then LlamaIndex is a better choice.
“Practically becoming a versatile tool of no use!”
“Practically becoming a versatile tool of no use!”
["langchain", "llamaindex"]
["Go", "GenAI", "AI", "llamaindex", "R", "ML", "LlamaIndex", "Scala", "Python", "LangChain", "Rust", "langchain"]
["AI", "ML", "GenAI", "LangChain", "LlamaIndex", "Python", "R", "Go", "Rust", "Scala"]
A software engineer who loves to experiment with new-gen AI. He also happens to love testing hardware and sometimes they crash. While reviving his crashed system, you can find him reading literature, manga, or watering plants.