https://github.com/coreprocess/python-openai-at-azure-example
Example on how to use OpenAI at Azure with Python
https://github.com/coreprocess/python-openai-at-azure-example
azure cognitive-services dotenv example gpt gpt-4 openai openai-api python python3 tenacity
Last synced: 5 months ago
JSON representation
Example on how to use OpenAI at Azure with Python
- Host: GitHub
- URL: https://github.com/coreprocess/python-openai-at-azure-example
- Owner: coreprocess
- Created: 2023-11-01T21:15:13.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-01T22:09:13.000Z (about 2 years ago)
- Last Synced: 2025-01-17T06:27:41.621Z (about 1 year ago)
- Topics: azure, cognitive-services, dotenv, example, gpt, gpt-4, openai, openai-api, python, python3, tenacity
- Language: Python
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Use OpenAI at Azure with Python
## Prerequisites for this Example
- Windows
- One of the latest Python 3.x releases: https://www.python.org/downloads/
- Microsoft C++ Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/
## Run this Example
```bash
# 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
```