Skip to content

Commit 3d67b4d

Browse files
committed
JS+TS: GPT-4 Turbo with Vision quickstart
1 parent 76c3cc9 commit 3d67b4d

File tree

2 files changed

+207
-1
lines changed

2 files changed

+207
-1
lines changed

articles/ai-services/openai/gpt-v-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Use this article to get started using Azure OpenAI to deploy and us
55
services: cognitive-services
66
manager: nitinme
77
ms.service: azure-ai-openai
8-
ms.custom: devx-track-python
8+
ms.custom: devx-track-python, devx-track-js, devx-track-ts
99
ms.topic: quickstart
1010
author: PatrickFarley
1111
ms.author: pafarley
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
---
2+
title: 'Quickstart: Use GPT-4 Turbo with Vision on your images and videos with the JavaScript SDK'
3+
titleSuffix: Azure OpenAI
4+
description: Get started using the OpenAI JavaScript SDK to deploy and use the GPT-4 Turbo with Vision model.
5+
services: cognitive-services
6+
manager: nitinme
7+
ms.service: azure-ai-openai
8+
ms.topic: include
9+
ms.custom: references_regions
10+
ms.date: 09/09/2024
11+
---
12+
13+
Use this article to get started using the OpenAI JavaScript SDK to deploy and use the GPT-4 Turbo with Vision model.
14+
15+
This SDK is provided by OpenAI with Azure specific types provided by Azure.
16+
17+
[Reference documentation](https://platform.openai.com/docs/api-reference/chat) | [Library source code](https://github.com/openai/openai-node?azure-portal=true) | [Package (npm)](https://www.npmjs.com/package/openai) | [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/openai/openai/samples)
18+
19+
20+
## Prerequisites
21+
22+
## [**TypeScript**](#tab/typescript)
23+
24+
- An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services?azure-portal=true)
25+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
26+
- [TypeScript](https://www.typescriptlang.org/download/)
27+
- An Azure OpenAI resource created in a supported region (see [Region availability](/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability)). For more information, see [Create a resource and deploy a model with Azure OpenAI](../how-to/create-resource.md).
28+
29+
30+
## [**JavaScript**](#tab/javascript)
31+
32+
- An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services?azure-portal=true)
33+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
34+
- An Azure OpenAI resource created in a supported region (see [Region availability](/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability)). For more information, see [Create a resource and deploy a model with Azure OpenAI](../how-to/create-resource.md).
35+
36+
---
37+
38+
39+
> [!NOTE]
40+
> This library is maintained by OpenAI. Refer to the [release history](https://github.com/openai/openai-python/releases) to track the latest updates to the library.
41+
42+
[!INCLUDE [get-key-endpoint](get-key-endpoint.md)]
43+
44+
[!INCLUDE [environment-variables](environment-variables.md)]
45+
46+
47+
## Create a Node application
48+
49+
In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app, and navigate to it. Then run the `npm init` command to create a node application with a _package.json_ file.
50+
51+
```console
52+
npm init
53+
```
54+
55+
## Install the client library
56+
57+
Install the client libraries with:
58+
59+
## [**TypeScript**](#tab/typescript)
60+
61+
```console
62+
npm install openai @azure/openai @azure/identity
63+
```
64+
65+
## [**JavaScript**](#tab/javascript)
66+
67+
```console
68+
npm install openai @azure/identity
69+
```
70+
71+
---
72+
73+
Your app's _package.json_ file will be updated with the dependencies.
74+
75+
## Create a new JavaScript application for image prompts
76+
77+
## [**TypeScript**](#tab/typescript)
78+
79+
1. Create a _quickstart.ts_ and paste in the following code.
80+
81+
```typescript
82+
```
83+
1. Make the following changes:
84+
1. Enter the name of your GPT-4 Turbo with Vision deployment in the appropriate field.
85+
1. Change the value of the `"url"` field to the URL of your image.
86+
> [!TIP]
87+
> You can also use a base 64 encoded image data instead of a URL. For more information, see the [GPT-4 Turbo with Vision how-to guide](../how-to/gpt-with-vision.md#use-a-local-image).
88+
89+
1. Build the application with the following command:
90+
91+
```console
92+
tsc
93+
```
94+
95+
1. Run the application with the following command:
96+
97+
```console
98+
node quickstart.js
99+
```
100+
101+
102+
## [**JavaScript**](#tab/javascript)
103+
104+
1. Replace the contents of _quickstart.js_ with the following code.
105+
106+
```javascript
107+
```
108+
1. Make the following changes:
109+
1. Enter the name of your GPT-4 Turbo with Vision deployment in the appropriate field.
110+
1. Change the value of the `"url"` field to the URL of your image.
111+
> [!TIP]
112+
> You can also use a base 64 encoded image data instead of a URL. For more information, see the [GPT-4 Turbo with Vision how-to guide](../how-to/gpt-with-vision.md#use-a-local-image).
113+
1. Run the application with the following command:
114+
115+
```console
116+
node quickstart.js
117+
```
118+
119+
## Create a new JavaScript application for image prompt enhancements
120+
121+
GPT-4 Turbo with Vision provides exclusive access to Azure AI Services tailored enhancements. When combined with Azure AI Vision, it enhances your chat experience by providing the chat model with more detailed information about visible text in the image and the locations of objects.
122+
123+
The **Optical Character Recognition (OCR)** integration allows the model to produce higher quality responses for dense text, transformed images, and number-heavy financial documents. It also covers a wider range of languages.
124+
125+
The **object grounding** integration brings a new layer to data analysis and user interaction, as the feature can visually distinguish and highlight important elements in the images it processes.
126+
127+
> [!CAUTION]
128+
> Azure AI enhancements for GPT-4 Turbo with Vision will be billed separately from the core functionalities. Each specific Azure AI enhancement for GPT-4 Turbo with Vision has its own distinct charges. For details, see the [special pricing information](../concepts/gpt-with-vision.md#special-pricing-information).
129+
130+
> [!IMPORTANT]
131+
> Vision enhancements are not supported by the GPT-4 Turbo GA model. They are only available with the preview models.
132+
133+
## [**TypeScript**](#tab/typescript)
134+
135+
1. Replace the contents of _quickstart.py_ with the following code.
136+
137+
```typescript
138+
139+
```
140+
141+
1. Make the following changes:
142+
1. Enter your GPT-4 Turbo with Vision deployment name in the appropriate field.
143+
1. Enter your Computer Vision endpoint URL and key in the appropriate fields.
144+
1. Change the value of the `"url"` field to the URL of your image.
145+
> [!TIP]
146+
> You can also use a base 64 encoded image data instead of a URL. For more information, see the [GPT-4 Turbo with Vision how-to guide](../how-to/gpt-with-vision.md#use-a-local-image).
147+
148+
149+
1. Build the application with the following command:
150+
151+
```console
152+
tsc
153+
```
154+
155+
1. Run the application with the following command:
156+
157+
```console
158+
node quickstart.js
159+
```
160+
161+
162+
## [**JavaScript**](#tab/javascript)
163+
164+
```javascript
165+
```
166+
167+
1. Make the following changes:
168+
1. Enter your GPT-4 Turbo with Vision deployment name in the appropriate field.
169+
1. Enter your Computer Vision endpoint URL and key in the appropriate fields.
170+
1. Change the value of the `"url"` field to the URL of your image.
171+
> [!TIP]
172+
> You can also use a base 64 encoded image data instead of a URL. For more information, see the [GPT-4 Turbo with Vision how-to guide](../how-to/gpt-with-vision.md#use-a-local-image).
173+
1. Run the application with the following command:
174+
175+
```console
176+
node quickstart.js
177+
```
178+
179+
---
180+
181+
1. Make the following changes:
182+
1. Enter your GPT-4 Turbo with Vision deployment name in the appropriate field.
183+
1. Enter your Computer Vision endpoint URL and key in the appropriate fields.
184+
1. Change the value of the `"url"` field to the URL of your image.
185+
> [!TIP]
186+
> You can also use a base 64 encoded image data instead of a URL. For more information, see the [GPT-4 Turbo with Vision how-to guide](../how-to/gpt-with-vision.md#use-a-local-image).
187+
1. Run the application with the `python` command:
188+
189+
```console
190+
python quickstart.py
191+
```
192+
193+
## Create a new JavaScript application for video prompt enhancements
194+
195+
Video prompt integration is outside the scope of this quickstart. See the [GPT-4 Turbo with Vision how-to guide](../how-to/gpt-with-vision.md#use-vision-enhancement-with-video) for detailed instructions on setting up video prompts in chat completions programmatically.
196+
197+
---
198+
199+
## Clean up resources
200+
201+
If you want to clean up and remove an Azure OpenAI resource, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with it.
202+
203+
- [Azure portal](../../multi-service-resource.md?pivots=azportal#clean-up-resources)
204+
- [Azure CLI](../../multi-service-resource.md?pivots=azcli#clean-up-resources)
205+
206+

0 commit comments

Comments
 (0)