Data Science Interview Preparation

What is Langgraph? Why do we need it? How is it different from Langchain?

 

LangGraph

What is LangGraph?

  • A framework for building stateful, multi-actor applications with large language models (LLMs).
  • Designed to handle complex scenarios and workflows involving multiple agents.
  • Provides fine-grained control over the flow and state of applications.

Why do we need LangGraph?

  • To create reliable and controllable agent workflows.
  • To manage complex tasks that require multiple steps and interactions.
  • To enable human-in-the-loop processes, where human approval or intervention is needed.

Example:

  • Scenario: Building a customer support chatbot that can escalate issues to a human agent.
    • Step 1: The chatbot handles initial customer queries.
    • Step 2: If the issue is complex, the chatbot escalates it to a human agent.
    • Step 3: The human agent reviews and resolves the issue, updating the chatbot’s state

Summary: Langgraph offers a repeated cycle of iterations (start from A --> B --->  C--> D-- > returned to A ) of Agentic env with full control to stop at any stage that is lacking in Langchain.


LangChain

What is LangChain?

  • A framework for developing applications powered by LLMs.
  • Provides building blocks and integrations for creating LLM-based applications.
  • Focuses on chaining together different components to build complex applications.

Why do we need LangChain?

  • To simplify the development of LLM applications.
  • To provide a standard interface and reusable components.
  • To integrate with various tools and services for enhanced functionality.

Example:

  • Scenario: Creating a document summarization tool.
    • Step 1: Use LangChain to integrate with an LLM for text analysis.
    • Step 2: Chain together components for extracting key points and summarizing the document.
    • Step 3: Output the summary to the user.

Differences between LangGraph and LangChain

  • Focus:
    • LangGraph: Emphasizes stateful, multi-actor workflows and fine-grained control.
    • LangChain: Focuses on chaining components to build LLM applications.
  • Use Cases:
    • LangGraph: Suitable for complex, multi-step tasks requiring human intervention.
    • LangChain: Ideal for building and deploying LLM applications with modular components.
  • Control:
    • LangGraph: Provides detailed control over the agent’s actions and state.
    • LangChain: Offers a flexible framework for chaining different functionalities.





'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();
Theme images by Barcin. Powered by Blogger.