You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-foundry/model-inference/includes/use-chat-multi-modal/javascript.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,9 +57,6 @@ const client = new ModelClient(
57
57
58
58
Some models can reason across text and images and generate text completions based on both kinds of input. In this section, you explore the capabilities of some models for vision in a chat fashion.
59
59
60
-
> [!IMPORTANT]
61
-
> Some models support only one image for each turn in the chat conversation and only the last image is retained in context. If you add multiple images, it results in an error.
62
-
63
60
To see this capability, download an image and encode the information as `base64` string. The resulting data should be inside of a [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs):
64
61
65
62
```javascript
@@ -130,13 +127,18 @@ Usage:
130
127
Total tokens: 2506
131
128
```
132
129
130
+
> [!IMPORTANT]
131
+
> Some models support only one image for each turn in the chat conversation and only the last image is retained in context. If you add multiple images, it results in an error.
132
+
133
133
## Use chat completions with audio
134
134
135
135
Some models can reason across text and audio inputs. The following example shows how you can send audio context to chat completions models that also supports audio.
136
136
137
137
In this example, we create a function `getAudioData` to load the content of the audio file encoded in `base64` data as the model expects it.
138
138
139
139
```javascript
140
+
importfsfrom"node:fs";
141
+
140
142
/**
141
143
* Get the Base 64 data of an audio file.
142
144
* @param{string}audioFile - The path to the image file.
0 commit comments