HOWTO: ChatGPT Demonstration From Your Azure Enclave Workspace

 

Introduction

Researchers who have been provisioned access to an Azure Enclave ChatGPT project workspace have the ability to run the following basic ChatGPT example for demonstrative purposes after configuring your OpenAI Key in Azure Key Vault.

Requirements

  • You have been provisioned access to an Azure Enclave ChatGPT Project Workspace and have your Azure Enclave Project Workspace Resource Group name provided in your welcome email.
  • You have basic knowledge of how to execute a ChatGPT conversation and tokens.

1. Create Azure Key Vault Secret

The below instructions show you have to create a secret to store your OpenAI key needed to run this demo and OpenAI from your Azure Enclave project workspace. INFOSEC best practices recommends storing this value in key vault. In addition, the instructions show how to obtain the values (#a, #c, #d) used as inputs to run the demo.

1. Login to your Azure Enclave project workspace.

2. Open another tab in your web browser and copy/paste this URL to access your list of project Resources. NOTE: Update the URL string with your Azure Enclave Project Workspace Resource Group value received in your welcome email.

https://portal.azure.com/#@partnershealthcare.onmicrosoft.com/resource/subscriptions/e3980824-3206-4fef-a3b7-4b89756bac30/resourceGroups/{Azure Enclave Project Workspace Resource Group}/overview

3. Click on Type Azure OpenAI.

4. Click Keys and Endpoints under Resource Management on left column.

5. Copy KEY 1 (your secret) and Endpoint (your Endpoint URL #a.) to notepad.

6. Click Model Deployments under Resource Management on left column.

7. Click Manage Deployments.

8. Click Deployments under Management on left column.

9. Copy Deployment Name value (your Model Name #e.) to notepad.

10. Go back to your list of project Resources and click on Type Key vault. Copy the Key Vault Name (#c) to notepad.

11. Click Secrets under Objects on the left column.

12. Click Generate/Import create your secret.

a. Create a unique Name. Copy the Name (#d) you created to notepad.

b. Copy from notepad your saved KEY 1 secret and paste into Secret value

c. Enter mmyy into Content type. Example: May2024

d. Click Create.

You have finished creating your Azure Key Vault Secret and have the necessary input variables needed to run the below demo.

2. Run Demonstration

1. From your Azure Enclave project workspace, download or import into your Azure Enclave Project Workspace the attached Python ChatGPTDemonstration.py file and update the file with the following in Visual Studio Code:

a. api_base Replace YourEndpointURLHere with the Endpoint URL copied from the Azure OpenAI resource.

b. api_version Use or replace with the appropriate API version. Further details can be found on the Microsoft Azure OpenAI Service REST API reference page.

c. keyVaultName Replace YourKeyVaultNameHere with the Key Vault Name resource you copied.

d. secretName Replace YourSecretNameHere with the Secret Name you entered when creating your secret.

e. deploymentName Replace YourDeploymentNameHere with the Deployment Name you copied.

3. Run ChatGPTDemonstration.py. Can be run with following CMD line command:  python ChatGPTDemonstration.py

4. Responses to the two questions are displayed in the Terminal tab.

The Azure Enclave Support team can assist with environment issues when executing ChatGPT conversations. We cannot provide technical support with specific tools. Researchers utilizing tools are expected to have knowledge and research solutions when using said tools.

For assistance with troubleshooting or platform support with your Azure Enclave Project Workspace environment, please open a Research Issue/Inquiry Request request. Please always include your unique Project Workspace IP Address on all communications.

Additional Resources

MS Azure OpenAI Service REST API reference

OpenAI What are tokens and how to count them?

MS OpenAI tokens and limits

Go to KB0040805 in the IS Service Desk

Related articles

Analytics Enclave

IDEA Platform