Gen-AI Developer Classroom notes 31/Mar/2026

Langchain

  • Langchain is a framework which abstracts
    • models
    • tools
    • prompts
    • all the other necessary components
  • Langchain supports two languages

    • python
    • javascript
  • In Langchain, most of the classes are dervied from Runnable

  • To interact with llm we need prompts

  • For llms (models) the base class is BaseChatModel
  • When we are prompting we have different types of messsage
    • System Prompt
    • Message
    • Response
    • Tool Call Responses
  • Langchain uses a class Called as BaseMessage and from this BaseMessage the other messages are derived
    • SystemMessage -> To set system prompt (define a role or set a persona)
    • HumanMessage -> This is the message to llm
    • AIMessage -> This is response from llm
    • ToolMessage -> This response includes tool calling structure
  • Refer Here for messages documentation

  • Base Prompt Template: is the base for all prompt templates

  • Understanding langchain packages

    • langchain-core: This package contains all the base implementations
    • langchain-community: Here we have additional packages to connect to vector database, documents, etc
    • langchain: This is major package
    • Vendor specific packages
      • GCP: langchain-google-genai
      • AWS: langchain-aws
      • Azure: langchain-azure-ai
      • openai: langchain-open-ai

Exercise: Lets create a project to get response from gcp vertex models

  • create a new directory hello_langchain
  • Lets initialize this folder uv init
  • Lets add some packages uv add
    • langchain-core
    • langchain
    • langchain-google-genai
  • Open Vs code and select interpretor

  • note: references

  • Refer Here for the work done in todays session

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading