Skip to main content


This notebook covers how to get started with Upstage chat models.


Install langchain-upstage package.

pip install -U langchain-upstage

Environment Setup

Make sure to set the following environment variables:


import os

os.environ["UPSTAGE_API_KEY"] = "YOUR_API_KEY"
from langchain_core.prompts import ChatPromptTemplate
from langchain_upstage import ChatUpstage

chat = ChatUpstage()
API Reference:ChatPromptTemplate
# using chat invoke
chat.invoke("Hello, how are you?")
# using chat stream
for m in"Hello, how are you?"):


# using chain
prompt = ChatPromptTemplate.from_messages(
("system", "You are a helpful assistant that translates English to French."),
("human", "Translate this sentence from English to French. {english_text}."),
chain = prompt | chat

chain.invoke({"english_text": "Hello, how are you?"})

Was this page helpful?

You can also leave detailed feedback on GitHub.