Skip to content

coreprocess/python-openai-at-azure-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use OpenAI at Azure with Python

Prerequisites for this Example

Run this Example

# check python version (run once)
python --version

# create new virtual environment (run once)
python -m venv .venv

# activate the virtual environment (run before each session)
.venv\Scripts\activate.ps1 # PowerShell
.venv\Scripts\activate.bat # CMD

# workaround currently necessary for Python 3.12, ignore if you use 3.11 or before (run once)
pip --require-virtualenv install aiohttp==3.9.0b0

# install openai dependency (run once)
pip --require-virtualenv install openai tenacity python-dotenv

# prepare environment variables (run once)
cp .env-template .env
code .env

# run the example script (run whenever you feel like it)
python example.py

# deactivate the virtual environment (run at the end of the session)
deactivate