Configure a Python Environment

# Initialize Conda Environment
conda create -n langchain
conda activate langchain

# Install LangChain dependencies
conda install langchain -c conda-forge
$Env:LANGCHAIN_TRACING_V2 = "true"
$Env:LANGCHAIN_API_KEY="<key>"

# Install OpenAI Dependencies
pip install python-dotenv
pip install langchain-openai
$Env:OPENAI_API_KEY="<key>"

Reference

LangChain ChatOpenAI Reference

💡
I work at Microsoft, but the views expressed here are my own and do not represent Microsoft's official positions, guidance, or content.