Feb. 27, 2024, 9:59 a.m. | Nari

DEV Community dev.to


An introduction to how to use Langchain.

Basic writing with LCEL will be introduced.

The model used was gpt-3.5-turbo.

Reference Documents

Official Documents






python -V
Python 3.11.6

pip install python-dotenv

pip install langchain
pip show langchain
Version: 0.1.9

pip install langchain-openai
pip show langchain-openai
Version: 0.0.7

pip install langchain-core
pip show langchain-core
Version: 0.1.27

Create File

Create a directory (e.g. test_langchain)

  • /test_langchain/.env

  • /test_langchain/test.py

ENV file

Set your OpenAI API Key.


Sample code

test.py …

basic core documents gpt gpt-3 gpt-3.5 gpt-3.5-turbo how to use langchain install introduction langchain openai pip python python 3 reference setup show turbo will writing

Data Scientist (m/f/x/d)

@ Symanto Research GmbH & Co. KG | Spain, Germany

Aumni - Site Reliability Engineer III - MLOPS

@ JPMorgan Chase & Co. | Salt Lake City, UT, United States

Senior Data Analyst

@ Teya | Budapest, Hungary

Technical Analyst (Data Analytics)

@ Contact Government Services | Chicago, IL

Engineer, AI/Machine Learning

@ Masimo | Irvine, CA, United States

Private Bank - Executive Director: Data Science and Client / Business Intelligence

@ JPMorgan Chase & Co. | Mumbai, Maharashtra, India