Foundations · 8 min

    What is LangChain?

    Video lesson · 8 min

    Objectives

    • Understand what LangChain is and why it exists
    • Learn the core abstractions LangChain provides
    • Identify when to use LangChain vs raw API calls

    Key Concepts

    LLM Orchestration — coordinating multiple AI model calls into coherent workflows

    Chains — composable sequences of operations that transform inputs to outputs

    Agents — autonomous decision-makers that choose which tools to use

    Memory — persistence layer that gives conversations context and continuity

    Code Example

    from langchain.llms import OpenAI
    from langchain.prompts import PromptTemplate
    from langchain.chains import LLMChain
    
    llm = OpenAI(temperature=0.7)
    prompt = PromptTemplate(
        input_variables=["topic"],
        template="Explain {topic} in simple terms."
    )
    
    chain = LLMChain(llm=llm, prompt=prompt)
    result = chain.run("vector databases")
    print(result)

    Tasks

    Quiz

    What is the primary purpose of LangChain?

    Which abstraction allows LangChain to remember previous interactions?