Skip to content
/ langchain-quickstart Public template

Jupyter notebook samples to quickly get started with OpenAI and LangChain

Notifications You must be signed in to change notification settings

pjirsa/langchain-quickstart

Repository files navigation

Langchain Quickstart

Use this template repo to quickly create a devcontainer enabled environment for experimenting with Langchain and OpenAI.

Included are several Jupyter notebooks that implement sample code found in the Langchain Quickstart guide.

  1. demo.ipynb - Basic sample, verifies you have valid API key and can call the OpenAI service.
  2. chains.ipynb - Your first (simple) chain.
  3. embeddings.ipynb - Sample of generating embeddings for given prompt (from Getting Started with LangChain: A Beginner’s Guide to Building LLM-Powered Applications).

Setup

  • Click Use this template
  • Clone to your local machine -OR- open in Codespace
  • In a terminal, run pip install -r requirements.txt
  • Create a '.env' file at root of repo
  • Add OPENAI_API_KEY="<your key here>" to .env file

.env setup

For OpenAI

  • Create a '.env' file at root of repo
  • Add OPENAI_API_KEY="<your key here>" to .env file

For Azure OpenAI

# Use for Azure OpenAI
OPENAI_API_KEY="<your key>"
OPENAI_API_BASE="https://<your instance name>.openai.azure.com/"
OPENAI_API_TYPE="azure"
OPENAI_API_VERSION= "2023-05-15"