Skip to content

Commit 2ccb84b

Browse files
authored
Merge pull request #280019 from MicrosoftDocs/main
7/3/2024 AM Publish
2 parents 3637397 + 9fca322 commit 2ccb84b

File tree

66 files changed

+1599
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1599
-565
lines changed

.openpublishing.redirection.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,6 +4195,12 @@
41954195
},
41964196
{
41974197

4198+
"source_path_from_root": "/articles/cosmos-db/how-to-move-regions.md",
4199+
"redirect_url": "/azure/operational-excellence/relocation-cosmos-db",
4200+
"redirect_document_id": false
4201+
4202+
},
4203+
{
41984204
"source_path_from_root": "/articles/site-recovery/move-vaults-across-regions.md",
41994205
"redirect_url": "/azure/operational-excellence/relocation-site-recovery",
42004206
"redirect_document_id": false

articles/active-directory-b2c/faq.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ sections:
274274
275275
* API connectors
276276
* Conditional Access
277+
278+
- question: |
279+
I am using rolling refresh tokens for my application and I am getting an invalid_grant error on redeeming newly acquired refresh tokens well within their set validity period. Why does this happen?
280+
answer: |
281+
While determining validity for rolling refresh tokens, B2C will consider the initial login time of the user in the application also to calculate the token validity skew. If the user haven't logged out of the application for a very long time, this skew value will exceed the validity period of the token and hence for security reasons the tokens will be considered as invalid. Hence the error. Inform the user to perform a proper logout and login back into the application and this should reset the skew. This scenario is not applicable if refresh token rolling is set as infinite rolling.
282+
277283
278284
- question: |
279285
I've revoked the refresh token using Microsoft Graph invalidateAllRefreshTokens, or Microsoft Graph PowerShell, Revoke-MgUserSignInSession. Why is Azure AD B2C still accepting the old refresh token?

articles/ai-services/openai/includes/chatgpt-java.md

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ ms.service: azure-ai-openai
88
ms.topic: include
99
author: mrbullwinkle
1010
ms.author: mbullwin
11-
ms.date: 07/26/2023
11+
ms.date: 07/03/2024
1212
---
1313

14-
[Source code](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/openai/azure-ai-openai) | [Artifact (Maven)](https://central.sonatype.com/artifact/com.azure/azure-ai-openai/1.0.0-beta.3) | [Samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/openai/azure-ai-openai/src/samples) | [Retrieval Augmented Generation (RAG) enterprise chat template](/azure/developer/java/quickstarts/get-started-app-chat-template) | [IntelliJ IDEA](/azure/developer/java/toolkit-for-intellij/chatgpt-intellij)
14+
[Source code](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/openai/azure-ai-openai) | [Artifact (Maven)](https://central.sonatype.com/artifact/com.azure/azure-ai-openai/1.0.0-beta.10) | [Samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/openai/azure-ai-openai/src/samples) | [Retrieval Augmented Generation (RAG) enterprise chat template](/azure/developer/java/quickstarts/get-started-app-chat-template) | [IntelliJ IDEA](/azure/developer/java/toolkit-for-intellij/chatgpt-intellij)
1515

1616
## Prerequisites
1717

@@ -55,7 +55,7 @@ When prompted to choose a **DSL**, select **Kotlin**.
5555
5656
## Install the Java SDK
5757

58-
This quickstart uses the Gradle dependency manager. You can find the client library and information for other dependency managers on the [Maven Central Repository](https://search.maven.org/artifact/com.microsoft.azure.cognitiveservices/azure-cognitiveservices-computervision).
58+
This quickstart uses the Gradle dependency manager. You can find the client library and information for other dependency managers on the [Maven Central Repository](https://central.sonatype.com/search?q=azure-ai-openai).
5959

6060
Locate *build.gradle.kts* and open it with your preferred IDE or text editor. Then copy in the following build configuration. This configuration defines the project as a Java application whose entry point is the class **OpenAIQuickstart**. It imports the Azure AI Vision library.
6161

@@ -71,7 +71,7 @@ repositories {
7171
mavenCentral()
7272
}
7373
dependencies {
74-
implementation(group = "com.azure", name = "azure-ai-openai", version = "1.0.0-beta.3")
74+
implementation(group = "com.azure", name = "azure-ai-openai", version = "1.0.0-beta.10")
7575
implementation("org.slf4j:slf4j-simple:1.7.9")
7676
}
7777
```
@@ -91,43 +91,50 @@ dependencies {
9191

9292
1. Open *OpenAIQuickstart.java* in your preferred editor or IDE and paste in the following code.
9393

94-
```java
94+
```java
95+
package com.azure.ai.openai.usage;
96+
9597
import com.azure.ai.openai.OpenAIClient;
9698
import com.azure.ai.openai.OpenAIClientBuilder;
9799
import com.azure.ai.openai.models.ChatChoice;
98100
import com.azure.ai.openai.models.ChatCompletions;
99101
import com.azure.ai.openai.models.ChatCompletionsOptions;
100-
import com.azure.ai.openai.models.ChatMessage;
101-
import com.azure.ai.openai.models.ChatRole;
102+
import com.azure.ai.openai.models.ChatRequestAssistantMessage;
103+
import com.azure.ai.openai.models.ChatRequestMessage;
104+
import com.azure.ai.openai.models.ChatRequestSystemMessage;
105+
import com.azure.ai.openai.models.ChatRequestUserMessage;
106+
import com.azure.ai.openai.models.ChatResponseMessage;
102107
import com.azure.ai.openai.models.CompletionsUsage;
103108
import com.azure.core.credential.AzureKeyCredential;
109+
import com.azure.core.util.Configuration;
104110
105111
import java.util.ArrayList;
106112
import java.util.List;
107113
108-
public class GetChatCompletionsSample {
109-
114+
115+
public class OpenAIQuickstart {
116+
110117
public static void main(String[] args) {
111-
String azureOpenaiKey = System.getenv("AZURE_OPENAI_API_KEY");;
112-
String endpoint = System.getenv("AZURE_OPENAI_ENDPOINT");;
113-
String deploymentOrModelId = "gpt-35-turbo"; //Change to match your deployment name
118+
String azureOpenaiKey = Configuration.getGlobalConfiguration().get("AZURE_OPENAI_API_KEY");
119+
String endpoint = Configuration.getGlobalConfiguration().get("AZURE_OPENAI_ENDPOINT");
120+
String deploymentOrModelId = "{azure-open-ai-deployment-model-id}";
114121
115-
OpenAIClient client = new OpenAIClientBuilder()
122+
OpenAIClient client = new OpenAIClientBuilder()
116123
.endpoint(endpoint)
117124
.credential(new AzureKeyCredential(azureOpenaiKey))
118125
.buildClient();
119126
120-
List<ChatMessage> chatMessages = new ArrayList<>();
121-
chatMessages.add(new ChatMessage(ChatRole.SYSTEM, "You are a helpful assistant"));
122-
chatMessages.add(new ChatMessage(ChatRole.USER, "Does Azure OpenAI support customer managed keys?"));
123-
chatMessages.add(new ChatMessage(ChatRole.ASSISTANT, "Yes, customer managed keys are supported by Azure OpenAI?"));
124-
chatMessages.add(new ChatMessage(ChatRole.USER, "Do other Azure AI services support this too?"));
127+
List<ChatRequestMessage> chatMessages = new ArrayList<>();
128+
chatMessages.add(new ChatRequestSystemMessage("You are a helpful assistant."));
129+
chatMessages.add(new ChatRequestUserMessage("Does Azure OpenAI support customer managed keys?"));
130+
chatMessages.add(new ChatRequestAssistantMessage("Yes, customer managed keys are supported by Azure OpenAI?"));
131+
chatMessages.add(new ChatRequestUserMessage("Do other Azure AI services support this too?"));
125132
126133
ChatCompletions chatCompletions = client.getChatCompletions(deploymentOrModelId, new ChatCompletionsOptions(chatMessages));
127134
128135
System.out.printf("Model ID=%s is created at %s.%n", chatCompletions.getId(), chatCompletions.getCreatedAt());
129136
for (ChatChoice choice : chatCompletions.getChoices()) {
130-
ChatMessage message = choice.getMessage();
137+
ChatResponseMessage message = choice.getMessage();
131138
System.out.printf("Index: %d, Chat Role: %s.%n", choice.getIndex(), message.getRole());
132139
System.out.println("Message:");
133140
System.out.println(message.getContent());
@@ -139,9 +146,10 @@ dependencies {
139146
+ "number of completion token is %d, and number of total tokens in request and response is %d.%n",
140147
usage.getPromptTokens(), usage.getCompletionTokens(), usage.getTotalTokens());
141148
}
142-
}
149+
}
143150
```
144151

152+
145153
> [!IMPORTANT]
146154
> For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../key-vault/general/overview.md). For more information about credential security, see the Azure AI services [security](../../security-features.md) article.
147155

articles/ai-studio/reference/reference-model-inference-api.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Content-Type: application/json
136136

137137
The Azure AI Model Inference API specifies a set of modalities and parameters that models can subscribe to. However, some models may have further capabilities that the ones the API indicates. On those cases, the API allows the developer to pass them as extra parameters in the payload.
138138

139-
By setting a header `extra-parameters: allow`, the API will attempt to pass any unknown parameter directly to the underlying model. If the model can handle that parameter, the request completes.
139+
By setting a header `extra-parameters: pass-through`, the API will attempt to pass any unknown parameter directly to the underlying model. If the model can handle that parameter, the request completes.
140140

141141
The following example shows a request passing the parameter `safe_prompt` supported by Mistral-Large, which isn't specified in the Azure AI Model Inference API:
142142

@@ -163,6 +163,7 @@ var messages = [
163163
];
164164

165165
var response = await client.path("/chat/completions").post({
166+
"extra-parameters": "pass-through",
166167
body: {
167168
messages: messages,
168169
safe_mode: true
@@ -178,7 +179,7 @@ __Request__
178179
POST /chat/completions?api-version=2024-04-01-preview
179180
Authorization: Bearer <bearer-token>
180181
Content-Type: application/json
181-
extra-parameters: allow
182+
extra-parameters: pass-through
182183
```
183184

184185
```JSON
@@ -203,7 +204,7 @@ extra-parameters: allow
203204
---
204205

205206
> [!TIP]
206-
> Alternatively, you can set `extra-parameters: drop` to drop any unknown parameter in the request. Use this capability in case you happen to be sending requests with extra parameters that you know the model won't support but you want the request to completes anyway. A typical example of this is indicating `seed` parameter.
207+
> The default value for `extra-parameters` is `error` which returns an error if an extra parameter is indicated in the payload. Alternatively, you can set `extra-parameters: ignore` to drop any unknown parameter in the request. Use this capability in case you happen to be sending requests with extra parameters that you know the model won't support but you want the request to completes anyway. A typical example of this is indicating `seed` parameter.
207208
208209
### Models with disparate set of capabilities
209210

@@ -426,3 +427,27 @@ __Response__
426427
## Getting started
427428

428429
The Azure AI Model Inference API is currently supported in certain models deployed as [Serverless API endpoints](../how-to/deploy-models-serverless.md) and Managed Online Endpoints. Deploy any of the [supported models](#availability) and use the exact same code to consume their predictions.
430+
431+
# [Python](#tab/python)
432+
433+
The client library `azure-ai-inference` does inference, including chat completions, for AI models deployed by Azure AI Studio and Azure Machine Learning Studio. It supports Serverless API endpoints and Managed Compute endpoints (formerly known as Managed Online Endpoints).
434+
435+
Explore our [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) and read the [API reference documentation](https://aka.ms/azsdk/azure-ai-inference/python/reference) to get yourself started.
436+
437+
# [JavaScript](#tab/javascript)
438+
439+
The client library `@azure-rest/ai-inference` does inference, including chat completions, for AI models deployed by Azure AI Studio and Azure Machine Learning Studio. It supports Serverless API endpoints and Managed Compute endpoints (formerly known as Managed Online Endpoints).
440+
441+
Explore our [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples) and read the [API reference documentation](https://aka.ms/AAp1kxa) to get yourself started.
442+
443+
# [REST](#tab/rest)
444+
445+
Explore the reference section of the Azure AI model inference API to see parameters and options to consume models, including chat completions models, deployed by Azure AI Studio and Azure Machine Learning Studio. It supports Serverless API endpoints and Managed Compute endpoints (formerly known as Managed Online Endpoints).
446+
447+
* [Get info](reference-model-inference-info.md): Returns the information about the model deployed under the endpoint.
448+
* [Text embeddings](reference-model-inference-embeddings.md): Creates an embedding vector representing the input text.
449+
* [Text completions](reference-model-inference-completions.md): Creates a completion for the provided prompt and parameters.
450+
* [Chat completions](reference-model-inference-chat-completions.md): Creates a model response for the given chat conversation.
451+
* [Image embeddings](reference-model-inference-images-embeddings.md): Creates an embedding vector representing the input text and image.
452+
453+
---

articles/ai-studio/reference/reference-model-inference-chat-completions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ POST /chat/completions?api-version=2024-04-01-preview
3535

3636
| Name | Required | Type | Description |
3737
| --- | --- | --- | --- |
38-
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `allow` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `drop` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
38+
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `pass-through` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `ignore` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
3939
| azureml-model-deployment | | string | Name of the deployment you want to route the request to. Supported for endpoints that support multiple deployments. |
4040

4141
## Request Body

articles/ai-studio/reference/reference-model-inference-completions.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ POST /completions?api-version=2024-04-01-preview
2828
| --- | --- | --- | --- | --- |
2929
| api-version | query | True | string | The version of the API in the format "YYYY-MM-DD" or "YYYY-MM-DD-preview". |
3030

31+
## Request Header
32+
33+
34+
| Name | Required | Type | Description |
35+
| --- | --- | --- | --- |
36+
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `pass-through` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `ignore` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
37+
| azureml-model-deployment | | string | Name of the deployment you want to route the request to. Supported for endpoints that support multiple deployments. |
38+
3139

3240
## Request Body
3341

@@ -285,4 +293,4 @@ The object type, which is always "list".
285293
| detail | [Detail](#detail) | |
286294
| error | string | The error description. |
287295
| message | string | The error message. |
288-
| status | integer | The HTTP status code. |
296+
| status | integer | The HTTP status code. |

articles/ai-studio/reference/reference-model-inference-embeddings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ POST /embeddings?api-version=2024-04-01-preview
3535

3636
| Name | Required | Type | Description |
3737
| --- | --- | --- | --- |
38-
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `allow` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `drop` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
38+
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `pass-through` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `ignore` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
3939
| azureml-model-deployment | | string | Name of the deployment you want to route the request to. Supported for endpoints that support multiple deployments. |
4040

4141
## Request Body

articles/ai-studio/reference/reference-model-inference-images-embeddings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ POST /images/embeddings?api-version=2024-04-01-preview
3535

3636
| Name | Required | Type | Description |
3737
| --- | --- | --- | --- |
38-
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `allow` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `drop` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
38+
| extra-parameters | | string | The behavior of the API when extra parameters are indicated in the payload. Using `pass-through` makes the API to pass the parameter to the underlying model. Use this value when you want to pass parameters that you know the underlying model can support. Using `ignore` makes the API to drop any unsupported parameter. Use this value when you need to use the same payload across different models, but one of the extra parameters may make a model to error out if not supported. Using `error` makes the API to reject any extra parameter in the payload. Only parameters specified in this API can be indicated, or a 400 error is returned. |
3939
| azureml-model-deployment | | string | Name of the deployment you want to route the request to. Supported for endpoints that support multiple deployments. |
4040

4141
## Request Body

0 commit comments

Comments
 (0)