Thuta Learning
LangChain
BasicAIAdvanced

Models (LLMs & Chat)

LangChainLesson 4

LangChain works with two kinds of language models:

• LLMs: models that take a text string as input and return a text string (e.g., "Tell me a joke." -> "Why don't scientists trust atoms? ...")

• Chat Models: take a list of chat messages as input and return a single chat message. (e.g., System, Human, AI messages)

python
from langchain_openai import ChatOpenAI

# Initialize the chat model
chat = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)

# Invoke the model with a message
response = chat.invoke("what is the capital of Myanmar?")

print(response.content)
You should see
The capital of Myanmar is Naypyidaw.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.