Connect to Azure OpenAI Using Postman

This blog post will show how to use Postman to request the REST API to the Azure OpenAI service platform.

Before you start, ensure you have access to the Azure OpenAI service and have resources deployed. Please visit this blog post to learn how to create OpenAI resources and deployment using Terraform.

Create Variables

To connect to Azure OpenAI from Postman, create the following two variables.

AZURE_OPENAI_KEY – Use your Security Key

AZURE_OPENAI_ENDPOINT – URL

You will find the above two values. Open your deployed Azure OpenAI service from the Azure portal under Azure AI Services.

Click on Keys and Secrets

Copy the values and add them to Postman variables. In our case, we are using them in a new environment.

Save the variables and create a new request with the following details.

Request type – POST

Use the URL below, but change the value of openai to your OpenAI resource name. Also, change the value of gpt-35-0613 to the name of your deployment.

{{AZURE_OPENAI_ENDPOINT}}/openai/deployments/gpt-35-0613/chat/completions?api-version=2023-05-15

The REST API request should look like this.

Use the following body to send a chat completion request in the Body section.

{"messages":[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "something"},{"role": "assistant", "content": "something."},{"role": "user", "content": "something"}]}

Click on Send and review the reply.


Posted

in

, , ,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.