Skip to content

Commit

Permalink
ShouldSendAudioTranscriptionAsync -> PASS
Browse files Browse the repository at this point in the history
  • Loading branch information
Catalin-Andronie committed Apr 2, 2023
1 parent e8648a3 commit 23c99ae
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// ----------------------------------------------------------------------------------
// Copyright (c) The Standard Organization, a coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System.Threading.Tasks;
using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions;
using Xunit;

namespace Standard.AI.OpenAI.Tests.Integration.APIs.AudioTranscriptions
{
public partial class AudioTranscriptionsApiTests
{
[Theory(Skip = "This test is only for releases")]
[InlineData(@"APIs\AudioTranscriptions\assets\OPENAI000_Getting_Started_15_sec.mp3")]
[InlineData(@"APIs\AudioTranscriptions\assets\OPENAI000_Getting_Started_30_sec.mp3")]
public async Task ShouldSendAudioTranscriptionAsync(string filePath)
{
// given
var inputAudioTranscription = new AudioTranscription
{
Request = new AudioTranscriptionRequest
{
Model = AudioTranscriptionModel.Whisper1,
FilePath = filePath
}
};

// when
AudioTranscription responseAudioTranscription =
await this.openAIClient.AudioTranscriptions.SendAudioTranscriptionAsync(
inputAudioTranscription);

// then
Assert.NotNull(responseAudioTranscription.Response);
Assert.NotNull(responseAudioTranscription.Response.Text);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ----------------------------------------------------------------------------------
// Copyright (c) The Standard Organization, a coalition of the Good-Hearted Engineers
// ----------------------------------------------------------------------------------

using System;
using Standard.AI.OpenAI.Clients.OpenAIs;
using Standard.AI.OpenAI.Models.Configurations;

namespace Standard.AI.OpenAI.Tests.Integration.APIs.AudioTranscriptions
{
public partial class AudioTranscriptionsApiTests
{
private readonly IOpenAIClient openAIClient;

public AudioTranscriptionsApiTests()
{
var openAIConfigurations = new OpenAIConfigurations
{
ApiKey = Environment.GetEnvironmentVariable("ApiKey"),
OrganizationId = Environment.GetEnvironmentVariable("OrgId"),
ApiUrl = "https://api.openai.com/"
};

this.openAIClient = new OpenAIClient(openAIConfigurations);
}
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<Content Include="APIs\AudioTranscriptions\assets\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Standard.AI.OpenAI\Standard.AI.OpenAI.csproj" />
</ItemGroup>
Expand Down

0 comments on commit 23c99ae

Please sign in to comment.