-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathvision.js
34 lines (31 loc) · 884 Bytes
/
vision.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import OpenAI from "openai";
const openai = new OpenAI();
const USER_INPUT = "What are the main differences between the two images?";
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{
role: "user",
content: [
{
type: "text",
text: USER_INPUT,
},
{
type: "image_url",
image_url: {
url: "https://publicstorageoaidemoenv.blob.core.windows.net/oai-sample-apps/vision-sample-image.webp",
},
},
{
type: "image_url",
image_url: {
url: "https://publicstorageoaidemoenv.blob.core.windows.net/oai-sample-apps/vision-sample-image2.webp",
},
},
],
},
],
});
console.log(`User input: ${USER_INPUT}\n-------------\n`);
console.log(response.choices[0].message.content);