Gen-AI Developer Classroom notes 29/Jun/2026

Chaining

  • When we interact with llm basic usage is

    • prompt
    • llm
  • we can chain these things

prompt | llm
  • I’m interacting with llm but i want response in json structure
prompt | llm | jsonstrcture
  • The above notations are referred as LCEL

PROMPT

  • PROMPT is an input to the model
  • The underlying LLM deals with different types of prompts

    • SYSTEM PROMPT => define the role
    • USER PROMPT => this is where we ask a question
  • When we pass this prompt we get a response

MESSAGES

  • When we interact with llm we will have different types of prompts or responses
    • System Prompt
    • User Prompt
    • Response from llm
  • To generalize this langchain does this. we have 4 types of messages
    • SystemMessage => (System Prompt)
    • HumanMessage => User Prompt
    • AIMessage => llm response
    • ToolMessage

Experiment

  • Create a new folder hello_llms
mkdir hello_llms
cd hello_llms
uv init .
  • Lets add a langchain package
#uv pip install langchain
uv add langchain
  • We need to interact with some llm
  • lets create an api key Refer Here
  • Install one more package
uv add python-dotenv
  • Create a new file called as .env with
GEMINI_API_KEY='paste your api key here'
  • Now since we are using gemini Refer Here

  • We need to install one more package

uv add langchain-google-genai
  • Now lets write simple code to interact with model
  • Refer Here for the changes

  • Now lets try chaining

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