Skip to content

Commit 6cbe1ca

Browse files
authored
Merge pull request #256590 from MicrosoftDocs/main
Publish to live, Monday 4 AM PST, 10/30
2 parents b9f375c + 1ff1c67 commit 6cbe1ca

38 files changed

+1543
-169
lines changed

articles/ai-services/speech-service/includes/quickstarts/openai-speech/csharp.md

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Follow these steps to create a new console application.
4141
```
4242
1. Replace the contents of `Program.cs` with the following code.
4343
44-
```csharp
44+
```csharp
4545
using System;
4646
using System.IO;
4747
using System.Threading.Tasks;
@@ -64,42 +64,67 @@ Follow these steps to create a new console application.
6464
// This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
6565
static string speechKey = Environment.GetEnvironmentVariable("SPEECH_KEY");
6666
static string speechRegion = Environment.GetEnvironmentVariable("SPEECH_REGION");
67-
67+
68+
// Sentence end symbols for splitting the response into sentences.
69+
static List<string> sentenceSaperators = new() { ".", "!", "?", ";", "。", "!", "?", ";", "\n" };
70+
71+
private static object consoleLock = new();
72+
6873
// Prompts Azure OpenAI with a request and synthesizes the response.
6974
async static Task AskOpenAI(string prompt)
7075
{
76+
var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);
77+
// The language of the voice that speaks.
78+
speechConfig.SpeechSynthesisVoiceName = "en-US-JennyMultilingualNeural";
79+
var audioOutputConfig = AudioConfig.FromDefaultSpeakerOutput();
80+
using var speechSynthesizer = new SpeechSynthesizer(speechConfig, audioOutputConfig);
81+
speechSynthesizer.Synthesizing += (sender, args) =>
82+
{
83+
lock (consoleLock)
84+
{
85+
Console.ForegroundColor = ConsoleColor.Yellow;
86+
Console.Write($"[Audio]");
87+
Console.ResetColor();
88+
}
89+
};
90+
7191
// Ask Azure OpenAI
7292
OpenAIClient client = new(new Uri(openAIEndpoint), new AzureKeyCredential(openAIKey));
7393
var completionsOptions = new CompletionsOptions()
7494
{
7595
Prompts = { prompt },
7696
MaxTokens = 100,
97+
7798
};
78-
Response<Completions> completionsResponse = client.GetCompletions(engine, completionsOptions);
79-
string text = completionsResponse.Value.Choices[0].Text.Trim();
80-
Console.WriteLine($"Azure OpenAI response: {text}");
81-
82-
var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);
83-
// The language of the voice that speaks.
84-
speechConfig.SpeechSynthesisVoiceName = "en-US-JennyMultilingualNeural";
85-
var audioOutputConfig = AudioConfig.FromDefaultSpeakerOutput();
86-
87-
using (var speechSynthesizer = new SpeechSynthesizer(speechConfig, audioOutputConfig))
99+
var responseStream = await client.GetCompletionsStreamingAsync(engine, completionsOptions);
100+
using var streamingCompletions = responseStream.Value;
101+
StringBuilder gptBuffer = new();
102+
await foreach (var choice in streamingCompletions.GetChoicesStreaming())
88103
{
89-
var speechSynthesisResult = await speechSynthesizer.SpeakTextAsync(text).ConfigureAwait(true);
90-
91-
if (speechSynthesisResult.Reason == ResultReason.SynthesizingAudioCompleted)
104+
await foreach (var message in choice.GetTextStreaming())
92105
{
93-
Console.WriteLine($"Speech synthesized to speaker for text: [{text}]");
94-
}
95-
else if (speechSynthesisResult.Reason == ResultReason.Canceled)
96-
{
97-
var cancellationDetails = SpeechSynthesisCancellationDetails.FromResult(speechSynthesisResult);
98-
Console.WriteLine($"Speech synthesis canceled: {cancellationDetails.Reason}");
99-
100-
if (cancellationDetails.Reason == CancellationReason.Error)
106+
if (string.IsNullOrEmpty(message))
107+
{
108+
continue;
109+
}
110+
111+
lock (consoleLock)
101112
{
102-
Console.WriteLine($"Error details: {cancellationDetails.ErrorDetails}");
113+
Console.ForegroundColor = ConsoleColor.DarkBlue;
114+
Console.Write($"{message}");
115+
Console.ResetColor();
116+
}
117+
118+
gptBuffer.Append(message);
119+
120+
if (sentenceSaperators.Any(message.Contains))
121+
{
122+
var sentence = gptBuffer.ToString().Trim();
123+
if (!string.IsNullOrEmpty(sentence))
124+
{
125+
await speechSynthesizer.SpeakTextAsync(sentence).ConfigureAwait(true);
126+
gptBuffer.Clear();
127+
}
103128
}
104129
}
105130
}
@@ -164,7 +189,7 @@ Follow these steps to create a new console application.
164189
}
165190
}
166191
}
167-
```
192+
```
168193

169194
1. To increase or decrease the number of tokens returned by Azure OpenAI, change the `MaxTokens` property in the `CompletionsOptions` class instance. For more information tokens and cost implications, see [Azure OpenAI tokens](/azure/ai-services/openai/overview#tokens) and [Azure OpenAI pricing](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/).
170195

articles/ai-services/speech-service/includes/quickstarts/openai-speech/python.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Follow these steps to create a new console application.
4848

4949
1. Copy the following code into `openai-speech.py`:
5050

51-
```Python
51+
```Python
5252
import os
5353
import azure.cognitiveservices.speech as speechsdk
5454
import openai
@@ -75,26 +75,30 @@ Follow these steps to create a new console application.
7575
# The language of the voice that responds on behalf of Azure OpenAI.
7676
speech_config.speech_synthesis_voice_name='en-US-JennyMultilingualNeural'
7777
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_output_config)
78+
79+
# tts sentence end mark
80+
tts_sentence_end = [ ".", "!", "?", ";", "。", "!", "?", ";", "\n" ]
7881
7982
# Prompts Azure OpenAI with a request and synthesizes the response.
8083
def ask_openai(prompt):
84+
# Ask Azure OpenAI in streaming way
85+
response = openai.Completion.create(engine=deployment_id, prompt=prompt, max_tokens=200, stream=True)
86+
collected_messages = []
87+
last_tts_request = None
8188
82-
# Ask Azure OpenAI
83-
response = openai.Completion.create(engine=deployment_id, prompt=prompt, max_tokens=100)
84-
text = response['choices'][0]['text'].replace('\n', ' ').replace(' .', '.').strip()
85-
print('Azure OpenAI response:' + text)
86-
87-
# Azure text to speech output
88-
speech_synthesis_result = speech_synthesizer.speak_text_async(text).get()
89-
90-
# Check result
91-
if speech_synthesis_result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
92-
print("Speech synthesized to speaker for text [{}]".format(text))
93-
elif speech_synthesis_result.reason == speechsdk.ResultReason.Canceled:
94-
cancellation_details = speech_synthesis_result.cancellation_details
95-
print("Speech synthesis canceled: {}".format(cancellation_details.reason))
96-
if cancellation_details.reason == speechsdk.CancellationReason.Error:
97-
print("Error details: {}".format(cancellation_details.error_details))
89+
# iterate through the stream response stream
90+
for chunk in response:
91+
if len(chunk['choices']) > 0:
92+
chunk_message = chunk['choices'][0]['text'] # extract the message
93+
collected_messages.append(chunk_message) # save the message
94+
if chunk_message in tts_sentence_end: # sentence end found
95+
text = ''.join(collected_messages).strip() # join the recieved message together to build a sentence
96+
if text != '': # if sentence only have \n or space, we could skip
97+
print(f"Speech synthesized to speaker for: {text}")
98+
last_tts_request = speech_synthesizer.speak_text_async(text)
99+
collected_messages.clear()
100+
if last_tts_request:
101+
last_tts_request.get()
98102
99103
# Continuously listens for speech input to recognize and send as text to Azure OpenAI
100104
def chat_with_open_ai():
@@ -128,7 +132,8 @@ Follow these steps to create a new console application.
128132
chat_with_open_ai()
129133
except Exception as err:
130134
print("Encountered exception. {}".format(err))
131-
```
135+
```
136+
132137
1. To increase or decrease the number of tokens returned by Azure OpenAI, change the `max_tokens` parameter. For more information tokens and cost implications, see [Azure OpenAI tokens](/azure/ai-services/openai/overview#tokens) and [Azure OpenAI pricing](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/).
133138

134139
Run your new console application to start speech recognition from a microphone:
48.8 KB
Loading
190 KB
Loading

articles/azure-monitor/logs/query-packs.md

Lines changed: 27 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,69 +13,39 @@ ms.date: 06/22/2022
1313
# Query packs in Azure Monitor Logs
1414
Query packs act as containers for log queries in Azure Monitor. They let you save log queries and share them across workspaces and other contexts in Log Analytics.
1515

16-
## View query packs
17-
You can view and manage query packs in the Azure portal from the **Log Analytics query packs** menu. Select a query pack to view and edit its permissions. This article describes how to create a query pack by using the API.
18-
19-
[![Screenshot that shows query packs.](media/query-packs/view-query-pack.png)](media/query-packs/view-query-pack.png#lightbox)
20-
2116
## Permissions
22-
You can set the permissions on a query pack when you view it in the Azure portal. Users require the following permissions to use query packs:
17+
You can set the permissions on a query pack when you view it in the Azure portal. You need the following permissions to use query packs:
2318

2419
- **Reader**: Users can see and run all queries in the query pack.
2520
- **Contributor**: Users can modify existing queries and add new queries to the query pack.
2621

2722
> [!IMPORTANT]
2823
> When a user needs to modify or add queries, always grant the user the Contributor permission on the `DefaultQueryPack`. Otherwise, the user won't be able to save any queries to the subscription, including in other query packs.
2924
25+
## View query packs
26+
You can view and manage query packs in the Azure portal from the **Log Analytics query packs** menu. Select a query pack to view and edit its permissions. This article describes how to create a query pack by using the API.
27+
28+
[![Screenshot that shows query packs.](media/query-packs/view-query-pack.png)](media/query-packs/view-query-pack.png#lightbox)
29+
3030
## Default query pack
31-
A query pack, called `DefaultQueryPack`, is automatically created in each subscription in a resource group called `LogAnalyticsDefaultResources` when the first query is saved. You can create queries in this query pack or create other query packs depending on your requirements.
31+
Azure Monitor automatically creates a query pack called `DefaultQueryPack` in each subscription in a resource group called `LogAnalyticsDefaultResources` when you save your first query. You can save queries to this query pack or create other query packs depending on your requirements.
3232

3333
## Use multiple query packs
34-
The single default query pack will be sufficient for most users to save and reuse queries. But there are reasons that you might want to create multiple query packs for users in your organization. For example, you might want to load different sets of queries in different Log Analytics sessions and provide different permissions for different collections of queries.
3534

36-
When you create a new query pack by using the API, you can add tags that classify queries according to your business requirements. For example, you could tag a query pack to relate it to a particular department in your organization or to severity of issues that the included queries are meant to address. By using tags, you can create different sets of queries intended for different sets of users and different situations.
35+
The default query pack is sufficient for most users to save and reuse queries. You might want to create multiple query packs for users in your organization if, for example, you want to load different sets of queries in different Log Analytics sessions and provide different permissions for different collections of queries.
3736

38-
## Query pack definition
39-
Each query pack is defined in a JSON file that includes the definition for one or more queries. Each query is represented by a block.
37+
When you [create a new query pack](#create-a-query-pack), you can add tags that classify queries based on your business needs. For example, you could tag a query pack to relate it to a particular department in your organization or to severity of issues that the included queries are meant to address. By using tags, you can create different sets of queries intended for different sets of users and different situations.
4038

41-
```json
42-
{
43-
"properties":
44-
{
45-
"displayName": "Query name that will be displayed in the UI",
46-
"description": "Query description that will be displayed in the UI",
47-
"body": "<<query text, standard KQL code>>",
48-
"related": {
49-
"categories": [
50-
"workloads"
51-
],
52-
"resourceTypes": [
53-
"microsoft.insights/components"
54-
],
55-
"solutions": [
56-
"logmanagement"
57-
]
58-
},
59-
"tags": {
60-
"Tag1": [
61-
"Value1",
62-
"Value2"
63-
]
64-
},
65-
}
66-
}
67-
```
39+
To add query packs to your Log Analytics workspace:
6840

69-
## Query properties
70-
Each query in the query pack has the following properties:
41+
1. Open Log Analytics and select **Queries** in the upper-right corner.
42+
1. In the upper-left corner on the **Queries** dialog, next to **Query packs**, click **0 selected**.
43+
1. Select the query packs that you want to add to the workspace.
7144

72-
| Property | Description |
73-
|:---|:---|
74-
| displayName | Display name listed in Log Analytics for each query. |
75-
| description | Description of the query displayed in Log Analytics for each query. |
76-
| body | Query written in Kusto Query Language. |
77-
| related | Related categories, resource types, and solutions for the query. Used for grouping and filtering in Log Analytics by the user to help locate their query. Each query can have up to 10 of each type. Retrieve allowed values from https://api.loganalytics.io/v1/metadata?select=resourceTypes, solutions, and categories. |
78-
| tags | Other tags used by the user for sorting and filtering in Log Analytics. Each tag will be added to Category, Resource Type, and Solution when you [group and filter queries](queries.md#find-and-filter-queries). |
45+
:::image type="content" source="media/query-packs/log-analytics-add-query-pack.png" alt-text="Screenshot that shows the Select query packs page in Log Analytics, where you can add query packs to a Log Analytics workspace." lightbox="media/query-packs/log-analytics-add-query-pack.png":::
46+
47+
> [!IMPORTANT]
48+
> You can add up to five query packs to a Log Analytics workspace.
7949
8050
## Create a query pack
8151
You can create a query pack by using the REST API or from the **Log Analytics query packs** pane in the Azure portal. To open the **Log Analytics query packs** pane in the portal, select **All services** > **Other**.
@@ -127,6 +97,16 @@ The payload of the request is the JSON that defines one or more queries and the
12797
}
12898
```
12999

100+
Each query in the query pack has the following properties:
101+
102+
| Property | Description |
103+
|:---|:---|
104+
| `displayName` | Display name listed in Log Analytics for each query. |
105+
| `description` | Description of the query displayed in Log Analytics for each query. |
106+
| `body` | Query written in Kusto Query Language. |
107+
| `related` | Related categories, resource types, and solutions for the query. Used for grouping and filtering in Log Analytics by the user to help locate their query. Each query can have up to 10 of each type. Retrieve allowed values from https://api.loganalytics.io/v1/metadata?select=resourceTypes, solutions, and categories. |
108+
| `tags` | Other tags used by the user for sorting and filtering in Log Analytics. Each tag will be added to Category, Resource Type, and Solution when you [group and filter queries](queries.md#find-and-filter-queries). |
109+
130110
### Create a request
131111
Use the following request to create a new query pack by using the REST API. The request should use bearer token authorization. The content type should be `application/json`.
132112

articles/azure-signalr/howto-enable-geo-replication.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,72 @@ With the new geo-replication feature, Contoso can now establish a replica in Can
5151
![Diagram of using one Azure SignalR instance with replica to handle traffic from two countries.](./media/howto-enable-geo-replication/signalr-replica.png "Replica Example")
5252

5353
## Create a SignalR replica
54-
54+
# [Portal](#tab/Portal)
5555
To create a replica, Navigate to the SignalR **Replicas** blade on the Azure portal and click **Add** to create a replica. It will be automatically enabled upon creation.
5656

5757
![Screenshot of creating replica for Azure SignalR on Portal.](./media/howto-enable-geo-replication/signalr-replica-create.png "Replica create")
5858

59-
> [!NOTE]
60-
> * Geo-replication is a feature available in premium tier.
61-
> * A replica is considered a separate resource when it comes to billing. See [Pricing and resource unit](#pricing-and-resource-unit) for more details.
62-
6359
After creation, you would be able to view/edit your replica on the portal by clicking the replica name.
6460

6561
![Screenshot of overview blade of Azure SignalR replica resource. ](./media/howto-enable-geo-replication/signalr-replica-overview.png "Replica Overview")
62+
# [Bicep](#tab/Bicep)
63+
64+
Use Visual Studio Code or your favorite editor to create a file with the following content and name it main.bicep:
65+
66+
```bicep
67+
@description('The name for your SignalR service')
68+
param primaryName string = 'contoso'
69+
70+
@description('The region in which to create your SignalR service')
71+
param primaryLocation string = 'eastus'
72+
73+
@description('Unit count of your SignalR service')
74+
param primaryCapacity int = 1
75+
76+
resource primary 'Microsoft.SignalRService/signalr@2023-08-01-preview' = {
77+
name: primaryName
78+
location: primaryLocation
79+
sku: {
80+
capacity: primaryCapacity
81+
name: 'Premium_P1'
82+
}
83+
properties: {
84+
}
85+
}
86+
87+
@description('The name for your SignalR replica')
88+
param replicaName string = 'contoso-westus'
89+
90+
@description('The region in which to create the SignalR replica')
91+
param replicaLocation string = 'westus'
92+
93+
@description('Unit count of the SignalR replica')
94+
param replicaCapacity int = 1
95+
96+
@description('Whether to enable region endpoint for the replica')
97+
param regionEndpointEnabled string = 'Enabled'
98+
99+
resource replica 'Microsoft.SignalRService/signalr/replicas@2023-08-01-preview' = {
100+
parent: primary
101+
name: replicaName
102+
location: replicaLocation
103+
sku: {
104+
capacity: replicaCapacity
105+
name: 'Premium_P1'
106+
}
107+
properties: {
108+
regionEndpointEnabled: regionEndpointEnabled
109+
}
110+
}
111+
```
112+
113+
Deploy the Bicep file using Azure CLI
114+
```azurecli
115+
az group create --name MyResourceGroup --location eastus
116+
az deployment group create --resource-group MyResourceGroup --template-file main.bicep
117+
```
118+
119+
----
66120

67121
## Pricing and resource unit
68122
Each replica has its **own** `unit` and `autoscale settings`.

articles/data-factory/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,10 @@ items:
507507
displayName: active directory
508508
- name: Microsoft Access
509509
href: connector-microsoft-access.md
510+
- name: Microsoft Fabric Lakehouse Files
511+
href: connector-microsoft-fabric-lakehouse-files.md
512+
- name: Microsoft Fabric Lakehouse Table
513+
href: connector-microsoft-fabric-lakehouse-table.md
510514
- name: MongoDB
511515
href: connector-mongodb.md
512516
items:

0 commit comments

Comments
 (0)