Learning Library

← Back to Library

LangChain: Orchestrating Multi‑LLM Applications

Key Points

  • LangChain is an open‑source orchestration framework (available for Python and JavaScript) that lets developers plug any large language model (e.g., GPT‑4, Llama 2) into a unified interface and combine it with data sources and software workflows.
  • It gained rapid popularity after its October 2022 launch, becoming the fastest‑growing open‑source project on GitHub by mid‑2023, and continues to provide practical utility despite a slight hype cooldown.
  • The library’s core design relies on **abstractions**—high‑level building blocks such as LLM wrappers, PromptTemplates, and Chains—that hide low‑level implementation details and let users compose complex NLP pipelines with minimal code.
  • Typical LangChain applications chain together steps (e.g., fetch web content → summarize → answer user queries), using PromptTemplates to format instructions and examples, and the LLM module to invoke any chosen model via a simple API key.

Full Transcript

# LangChain: Orchestrating Multi‑LLM Applications **Source:** [https://www.youtube.com/watch?v=1bUy-1hGZpI](https://www.youtube.com/watch?v=1bUy-1hGZpI) **Duration:** 00:08:09 ## Summary - LangChain is an open‑source orchestration framework (available for Python and JavaScript) that lets developers plug any large language model (e.g., GPT‑4, Llama 2) into a unified interface and combine it with data sources and software workflows. - It gained rapid popularity after its October 2022 launch, becoming the fastest‑growing open‑source project on GitHub by mid‑2023, and continues to provide practical utility despite a slight hype cooldown. - The library’s core design relies on **abstractions**—high‑level building blocks such as LLM wrappers, PromptTemplates, and Chains—that hide low‑level implementation details and let users compose complex NLP pipelines with minimal code. - Typical LangChain applications chain together steps (e.g., fetch web content → summarize → answer user queries), using PromptTemplates to format instructions and examples, and the LLM module to invoke any chosen model via a simple API key. ## Sections - [00:00:00](https://www.youtube.com/watch?v=1bUy-1hGZpI&t=0s) **LangChain: Orchestrating Multiple LLMs** - LangChain is an open‑source framework that enables developers to combine different large language models and integrate them with data sources and software workflows through high‑level abstractions. ## Full Transcript
0:00now stop me if you've heard this one 0:01before but there are a lot of large 0:03language models available today and they 0:06have their own capabilities and 0:07specialities what if I prefer to use one 0:10llm to interpret some user queries in my 0:12business application but a whole other 0:15llm to author a response to those 0:18queries well that scenario is exactly 0:21what Lang chain caters to Lang chain is 0:24an open-source orchestration framework 0:27for the development of applications that 0:29use large language models and it comes 0:31in both Python and JavaScript libraries 0:34it's it's essentially a generic 0:36interface for nearly any llm so you have 0:39a centralized development environment to 0:41build your large language model 0:42applications and then integrate them 0:44with stuff like data sources and 0:47software workflows now when it was 0:49launched by Harrison Chase in October 0:512022 Lang chain enjoyed a meteoric rise 0:54and by June of the following year it was 0:56the single fastest growing open- source 0:58project on GitHub and while the Lang 1:01chain hype 1:03train has uh slightly cooled a little 1:06bit there's plenty of utility here so 1:09let's take a look at its components so 1:13what makes up Lang 1:18chain well Lang chain streamlines the 1:20programming of llm applications through 1:23something called abstractions now what 1:25do I mean by that well your thermostat 1:27that allows you to control the 1:28temperature in your home with without 1:30needing to understand all the complex 1:31circuitary that this entails we just set 1:34the temperature that's an abstraction so 1:37Lang chains abstractions represent 1:39common steps and Concepts necessary to 1:41work with language models and they can 1:44be chained together to create 1:47applications minimizing the amount of 1:48code required to execute complex NLP 1:51tasks so let's start with the 1:56llm module now nearly any LM LM can be 2:01used in Lang chain you just need an API 2:03key the llm class is designed to provide 2:06a standard interface for all models so 2:08pick an llm of your choice be that a 2:11closed Source One like gp4 or an Open 2:14Source One like llama 2 or this being 2:17Lang chain pick both okay what else we 2:21got we have 2:25prompts now prompts are the instructions 2:27given to a large language model and the 2:29prompt template class in Lang chain 2:32formalizes the composition of prompts 2:34without the need to manually hardcode 2:36context and queries a prompt template 2:39can contain instructions like uh do not 2:42use technical terms in your response 2:44that would be a good one or it could be 2:46a set of examples to guide its responses 2:48that's called f shot prompting or it 2:50could specify an output 2:52format now 2:54chains as the name implies are the core 2:58of Lang chain workflows they combine 3:01llms with other components creating 3:03applications by executing a sequence of 3:05functions so let's say our application 3:08that needs to first of all retrieve data 3:10from a website then it needs to 3:12summarize the text it gets back and then 3:14finally it needs to use that summary to 3:17answer User submitted questions that's a 3:20sequential chain where the output of one 3:22function access the input to the next 3:24and each function in the chain could use 3:27different prompts different parameters 3:29and even different 3:31models now to achieve certain tasks llms 3:34might need to access specific external 3:37data sources that are not included in 3:39the training data set of the llm itself 3:43so things like internal documents or 3:45emails that sort of thing now Lang chain 3:47collectively refers to this sort of 3:50documentation as 3:53indexes and there are a number of them 3:56so let's take a look at a few now one of 3:59them 4:00is called a 4:02document 4:04loader now document loaders they work 4:07with thirdparty applications for 4:09importing data sources from sources like 4:11file storage services so think Dropbox 4:14or Google drive or web content from like 4:18YouTube transcripts or collaboration 4:20tools like air table or databases like 4:23pandas and mongod 4:24DB there's also support for vector 4:30databases as well now unlike traditional 4:34structured databases Vector databases 4:36represent data points by converting them 4:38into something called Vector embeddings 4:40which are numerical representations in 4:42the form of vectors with a fixed number 4:44of dimensions and you can store a lot of 4:46information in this format as as it's a 4:48very efficient means of retrieval there 4:51are also something called text 4:55Splitters which can be very useful as 4:58well because they can split text up into 5:00small semantically meaningful chunks 5:02that can then be combined using the 5:04methods and parameters of your 5:06choosing Now llms by default don't 5:09really have any long-term memory of 5:11Prior conversations unless you happen to 5:13pass the chat history in as an input to 5:16your query but Lang chain solves this 5:18problem with simple utilities for adding 5:22in memory into your 5:25application and you have options retain 5:28for retaining like the entire High 5:29conversations through two options to 5:32just retain a summarization of the 5:34conversation that we've had so far and 5:36then finally the last one we'll look at 5:39are agents now agents can use a given 5:43language model as a reasoning engine to 5:45determine which actions to take and when 5:48building a chain for an agent you'll 5:50want to include inputs like a list of 5:52the available tools that it should use 5:54uh the user input like the prompts and 5:56the queries and then any other relevant 5:58previously executed steps so how can we 6:03put all of this to work for our 6:05applications well let's talk about a few 6:08Lang chain use cases now obviously we 6:11have chatbots Lang chain can be used to 6:14provide proper context for the specific 6:17use of a chatbot and to integrate 6:20chatbots into existing communication 6:22channels and workflows with their own 6:25apis we also have summarization language 6:29model can be tasked with summarizing 6:31many types of text from breaking down 6:34complex academic papers and transcripts 6:36to providing just a digest of incoming 6:39emails we've also seen lots of examples 6:42where this is used for question 6:43answering so using specific documents or 6:46specialized knowledge basis llms can 6:49retrieve the relevant information from 6:50the storage and then articulate helpful 6:52answers using the information that would 6:54otherwise not have been in their 6:56training data set and uh yeah this is a 6:59good one data augmentation llms can be 7:02used to generate synthetic data for use 7:05of machine learning so for example llm 7:08can be trained to generate additional 7:09samples that closely resemble the real 7:12data points in a training data set and 7:15there are of course virtual agents as we 7:18already started to discuss integrated 7:20with the the right workflows Lang chains 7:23agent modules can use an llm to 7:25autonomously determine the next steps 7:27and then take the action that it needs 7:28to complete that step using something 7:30called RPA or robotic process 7:33automation Lang chain is open source and 7:36free to use there are also related 7:38Frameworks like Lang serve for creating 7:40chains as rest apis and Lang Smith which 7:43provides tools to monitor evaluate and 7:45debug applications essentially Lang 7:48Chain's tools and apis simplify the 7:51process of building applications that 7:53make use of large language 7:56models if you have any questions please 7:58drop us a line below and if you want to 8:00see more videos like this in the future 8:03please like And subscribe thanks for 8:06watching