Basic Chatmodels - Official Doc

Site: Freebirds Moodle
Course: Introduction to Large Language Models
Book: Basic Chatmodels - Official Doc
Printed by: Guest user
Date: Wednesday, 5 November 2025, 9:32 AM

Build a python project environment

  • Install anaconda
  • Create an environment
  • create a Project folder
  • Follow along this tutorial to save your api-keys

Simple LLM Application

Read and work along this langchain tutorial:

https://python.langchain.com/docs/tutorials/llm_chain/

Make a note of major learnings.

Exercise: Execute the code in this doc in your own device

Execute the code in this doc in your own device. 


Question: multiple ways of calling a model

Are the following model calls equivalent? 

model.invoke("Hello")

model.invoke([{"role": "user", "content": "Hello"}])

model.invoke([HumanMessage("Hello")])

How can you verify your guess?

Question: Invoke vs streaming?

What is the difference between? 

model.invoke("hi")

and

model.stream("hi")

Exercise: Check Model's IQ

  • Ask a model to generate a question to check someone's IQ. 
  • Ask that same question to a different model.

Ans notebook:

https://github.com/krajit/MAT496-Monsoon2025/blob/main/mod01_langchain_basics/nb01a_models_IQ_testing.ipynb