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-services/openai/how-to/migration-javascript.md
+4-9Lines changed: 4 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ import { DefaultAzureCredential } from "@azure/identity";
28
28
const credential =newDefaultAzureCredential();
29
29
```
30
30
31
-
Which is then passed to the second argument of the `OpenAIClient` and `AssistantsClient` client constructors.
31
+
This object is then passed to the second argument of the `OpenAIClient` and `AssistantsClient` client constructors.
32
32
33
33
In order to authenticate the `AzureOpenAI` client, however, we need to use the `getBearerTokenProvider` function from the `@azure/identity` package. This function creates a token provider that `AzureOpenAI` uses internally to obtain tokens for each request. The token provider is created as follows:
let runResponse =awaitassistantsClient.createRun(assistantThread.id, {
356
351
assistantId: assistantResponse.id,
@@ -452,7 +447,7 @@ Note that:
452
447
453
448
### Content filter
454
449
455
-
Content filter results is part of the chat completions response types in `OpenAIClient`. The following example shows how to access the content filter results.
450
+
Content filter results are part of the chat completions response types in `OpenAIClient`. The following example shows how to access the content filter results.
456
451
457
452
# [OpenAI JavaScript (new)](#tab/javascript-new)
458
453
@@ -563,6 +558,6 @@ The following table explores several type names from `@azure/openai` and shows t
563
558
564
559
`AzureOpenAI` connects to the Azure OpenAI service and can call all the operations available in the service. However, the types of the requests and responses are inherited from the `OpenAI` and are not yet updated to reflect the additional features supported exclusively by the Azure OpenAI service. TypeScript users will be required to cast to a more permissive type such as `Record<string, any>` to access those features. Examples in [the Migration examples](#migration-examples) section show how to do this.
0 commit comments