Skip to content

Commit

Permalink
Merge branch 'jvandervegte/RevertYetAnotherRevert' into rhurey/remove…
Browse files Browse the repository at this point in the history
…_xamarin
  • Loading branch information
rhurey committed Aug 23, 2024
2 parents 8ccb178 + 7660a7f commit 7f2345e
Show file tree
Hide file tree
Showing 20 changed files with 345 additions and 270 deletions.
29 changes: 29 additions & 0 deletions samples/ingestion/ingestion-client/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Ingestion Client",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"ghcr.io/rchaganti/vsc-devcontainer-features/azurebicep:1.0.5": {}
},
"postCreateCommand": "pre-commit install",
"customizations": {
"vscode": {
"extensions": [
"github.vscode-pull-request-github",
"ms-dotnettools.csdevkit",
"ms-vscode.azure-account",
"ms-azuretools.vscode-azurefunctions",
"editorconfig.editorconfig",
"ms-azuretools.vscode-bicep",
"ms-dotnettools.vscode-dotnet-runtime"
],
"settings": {
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.enableEditorConfigSupport": true
}
}
}
}
12 changes: 12 additions & 0 deletions samples/ingestion/ingestion-client/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
1 change: 1 addition & 0 deletions samples/ingestion/ingestion-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local.settings.json
4 changes: 2 additions & 2 deletions samples/ingestion/ingestion-client/Connector/BatchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class BatchClient
{
private const string TranscriptionsBasePath = "speechtotext/v3.0/Transcriptions/";

private const int MaxNumberOfRetries = 3;
private const int MaxNumberOfRetries = 10;

private static readonly TimeSpan PostTimeout = TimeSpan.FromMinutes(1);

Expand All @@ -34,7 +34,7 @@ public static class BatchClient
private static readonly AsyncRetryPolicy RetryPolicy =
Policy
.Handle<Exception>(e => e is HttpStatusCodeException || e is HttpRequestException)
.WaitAndRetryAsync(MaxNumberOfRetries, retryAttempt => TimeSpan.FromSeconds(2));
.WaitAndRetryAsync(MaxNumberOfRetries, retryAttempt => TimeSpan.FromSeconds(5));

public static Task<TranscriptionReportFile> GetTranscriptionReportFileFromSasAsync(string sasUri)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// <copyright file="TranscriptionAnalyticsJobStatus.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace Connector.Enums
{
public enum TranscriptionAnalyticsJobStatus
{
NotSubmitted,
Running,
Completed
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public TextAnalyticsRequests(
IEnumerable<TextAnalyticsRequest> audioLevelRequests,
IEnumerable<TextAnalyticsRequest> conversationRequests)
{
this.UtteranceLevelRequests = utteranceLevelRequests;
this.AudioLevelRequests = audioLevelRequests;
this.ConversationRequests = conversationRequests;
this.UtteranceLevelRequests = utteranceLevelRequests ?? new List<TextAnalyticsRequest>();
this.AudioLevelRequests = audioLevelRequests ?? new List<TextAnalyticsRequest>();
this.ConversationRequests = conversationRequests ?? new List<TextAnalyticsRequest>();
}

public IEnumerable<TextAnalyticsRequest> UtteranceLevelRequests { get; }
public IEnumerable<TextAnalyticsRequest> UtteranceLevelRequests { get; set; }

public IEnumerable<TextAnalyticsRequest> AudioLevelRequests { get; }
public IEnumerable<TextAnalyticsRequest> AudioLevelRequests { get; set; }

public IEnumerable<TextAnalyticsRequest> ConversationRequests { get; }
public IEnumerable<TextAnalyticsRequest> ConversationRequests { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public async Task MoveFileAsync(string inputContainerName, string inputFileName,

if (!keepSource)
{
await inputBlockBlobClient.DeleteAsync().ConfigureAwait(false);
await inputBlockBlobClient.DeleteIfExistsAsync().ConfigureAwait(false);
}

return;
Expand All @@ -131,7 +131,7 @@ public async Task MoveFileAsync(string inputContainerName, string inputFileName,

if (!keepSource)
{
await inputBlockBlobClient.DeleteAsync().ConfigureAwait(false);
await inputBlockBlobClient.DeleteIfExistsAsync().ConfigureAwait(false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscriptionFunction
namespace FetchTranscription
{
using System;
using System.Threading.Tasks;
Expand Down
25 changes: 25 additions & 0 deletions samples/ingestion/ingestion-client/FetchTranscription/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Local development instructions

Pre-requisites:
1. Please follow the instructions on [the main guide](./../infra/guide.md#ingestion-client-setup-instructions) to deploy the Ingestion Client and associated ecosystem to Azure.
2. Reopen the project within a [devcontainer](https://containers.dev/overview). (The devcontainer settings at the root of the project have the tools needed to develop and run this function locally)

To run the FetchTranscription function locally, do the following:

1. Run the following command to fetch your Azure Function app settings and save them to local.settings.json:

```
func azure functionapp fetch-app-settings <function app name>
```

Note: Replace `<function app name>` with the actual name of your function app that you can get from the Azure Portal. It will look like `FetchTranscriptionFunction-20240531T092901Z`.

2. In the local.settings.json file generated by the previous step, replace the value of the `AzureSpeechServicesKey` with the actual key for your Azure Speech Service instance. You can get this from the Azure portal. (If you're using the SQL database or the Text Analytics, do the same for these keys as well)

3. Navigate to the FetchTranscription function running on your Azure via the portal, and click on Stop. You need to do this so that you don't have two instances of the FetchTranscription function running and listening to the same events when you start the function from your local machine in the next step.

4. Run the following command to start the local function (this will apply your local code changes):

```
func start
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <copyright file="ITranscriptionAnalyticsProvider.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscription
{
using System.Collections.Generic;
using System.Threading.Tasks;

using Connector;
using Connector.Enums;
using Connector.Serializable.TranscriptionStartedServiceBusMessage;

public interface ITranscriptionAnalyticsProvider
{
/// <summary>
/// Gets the status of the transcription analytics jobs that are monitored by the provider
/// </summary>
/// <param name="audioFileInfos">The audio file infos with transcription analytics jobs info</param>
/// <returns>The overall status of all jobs monitored by the provider</returns>
Task<TranscriptionAnalyticsJobStatus> GetTranscriptionAnalyticsJobStatusAsync(IEnumerable<AudioFileInfo> audioFileInfos);

/// <summary>
/// Submits transcription analytics jobs based on the transcript in speechtranscript and sets the job ids in the corresponding audio file infos.
/// </summary>
/// <param name="speechTranscriptMappings">The mapping from audio file info to transcript</param>
/// <returns>The errors if any.</returns>
Task<IEnumerable<string>> SubmitTranscriptionAnalyticsJobsAsync(Dictionary<AudioFileInfo, SpeechTranscript> speechTranscriptMappings);

/// <summary>
/// Fetches the transcription analytics results and adds them to the corresponding speech transcript
/// </summary>
/// <param name="speechTranscriptMappings">The mapping from audio file info to transcript</param>
/// <returns>The errors if any.</returns>
Task<IEnumerable<string>> AddTranscriptionAnalyticsResultsToTranscriptsAsync(Dictionary<AudioFileInfo, SpeechTranscript> speechTranscriptMappings);
}
}
Loading

0 comments on commit 7f2345e

Please sign in to comment.