Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 49503e8

Browse files
authored
Merge pull request #55 from AssemblyAI/fern-bot/10-17-2024-0923PM
🌿 Fern Regeneration -- October 17, 2024
2 parents 607f1a8 + 5cc2c0e commit 49503e8

23 files changed

+254
-26
lines changed

.fernignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ src/AssemblyAI/AssemblyAI.csproj
1212
src/AssemblyAI/Core/JsonConfiguration.cs
1313
src/AssemblyAI/Core/Public/ApiException.cs
1414
src/AssemblyAI/Core/Public/AssemblyAIException.cs
15+
src/AssemblyAI/Core/StringEnumSerializer.cs
1516
src/AssemblyAI/Core/CustomConstants.cs
1617
src/AssemblyAI/Types/Error.cs
1718
src/AssemblyAI/UserAgent.cs
@@ -23,6 +24,7 @@ src/AssemblyAI/Files/ExtendedFilesClient.cs
2324
src/AssemblyAI/Transcripts/ExtendedTranscriptsClient.cs
2425
src/AssemblyAI/Transcripts/Types/TranscriptExtensions.cs
2526
src/AssemblyAI/Transcripts/Types/TranscriptParamsMapper.cs
27+
src/AssemblyAI/Transcripts/Types/TranscriptParamsCloner.cs
2628
src/AssemblyAI/Transcripts/TranscriptNotCompletedStatusException.cs
2729
src/AssemblyAI/Lemur/Types/LemurResponse.cs
2830
src/AssemblyAI/Realtime/RealtimeTranscriber.cs
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using AssemblyAI.Transcripts;
2+
3+
namespace AssemblyAI.IntegrationTests;
4+
5+
[TestFixture]
6+
public class SpeechRecognitionTests
7+
{
8+
[Test]
9+
public async Task Should_Transcribe_Multichannel()
10+
{
11+
var client = Helpers.CreateClient();
12+
13+
var transcript = await client.Transcripts.TranscribeAsync(new TranscriptParams
14+
{
15+
AudioUrl = "https://assemblyai-test.s3.us-west-2.amazonaws.com/e2e_tests/en_7dot1_audio_channels.wav",
16+
Multichannel = true
17+
}
18+
).ConfigureAwait(false);
19+
var expectedOutput = new[] { "One.", "Two.", "Three.", "Four.", "Five.", "Six.", "Seven.", "Eight." };
20+
21+
Assert.That(transcript.Multichannel, Is.True);
22+
Assert.That(transcript.Words!, Is.Not.Null);
23+
Assert.That(transcript.Utterances, Is.Not.Null);
24+
var words = transcript.Words!.ToList();
25+
var utterances = transcript.Utterances!.ToList();
26+
Assert.That(words, Has.Count.EqualTo(expectedOutput.Length));
27+
Assert.That(utterances, Has.Count.EqualTo(expectedOutput.Length));
28+
for (var i = 0; i < expectedOutput.Length; i++)
29+
{
30+
var channelString = (i + 1).ToString();
31+
var expectedWord = expectedOutput[i];
32+
Assert.Multiple(() =>
33+
{
34+
Assert.That(words[i].Text, Is.EqualTo(expectedWord));
35+
Assert.That(words[i].Speaker, Is.EqualTo(channelString));
36+
Assert.That(words[i].Channel, Is.EqualTo(channelString));
37+
Assert.That(utterances[i].Text, Is.EqualTo(expectedWord));
38+
Assert.That(utterances[i].Speaker, Is.EqualTo(channelString));
39+
Assert.That(utterances[i].Channel, Is.EqualTo(channelString));
40+
Assert.That(utterances[i].Words.Count(), Is.EqualTo(1));
41+
var utteranceWord = utterances[i].Words.First();
42+
Assert.Multiple(() =>
43+
{
44+
Assert.That(utteranceWord.Text, Is.EqualTo(expectedWord));
45+
Assert.That(utteranceWord.Speaker, Is.EqualTo(channelString));
46+
Assert.That(utteranceWord.Channel, Is.EqualTo(channelString));
47+
});
48+
});
49+
}
50+
}
51+
}

src/AssemblyAI.UnitTests/EnumConverterTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using AssemblyAI.Lemur;
12
using AssemblyAI.Transcripts;
23
using NUnit.Framework;
34

@@ -19,4 +20,28 @@ public void ConvertEnumToString()
1920
var result = EnumConverter.ToString(TranscriptLanguageCode.EnUs);
2021
Assert.That(result, Is.EqualTo("en_us"));
2122
}
23+
24+
[Test]
25+
public void ConvertStringToClaude2_0()
26+
{
27+
var result = EnumConverter.ToEnum<LemurModel>("anthropic/claude-2");
28+
Assert.That(result, Is.EqualTo(LemurModel.AnthropicClaude2_0));
29+
#pragma warning disable CS0618 // Type or member is obsolete
30+
Assert.That(result, Is.Not.EqualTo(LemurModel.AnthropicClaude2));
31+
#pragma warning restore CS0618 // Type or member is obsolete
32+
}
33+
34+
[Test]
35+
public void ConvertClaude2_0ToString()
36+
{
37+
var result1 = EnumConverter.ToString(LemurModel.AnthropicClaude2_0);
38+
#pragma warning disable CS0618 // Type or member is obsolete
39+
var result2 = EnumConverter.ToString(LemurModel.AnthropicClaude2);
40+
#pragma warning restore CS0618 // Type or member is obsolete
41+
Assert.Multiple(() =>
42+
{
43+
Assert.That(result1, Is.EqualTo("anthropic/claude-2"));
44+
Assert.That(result2, Is.EqualTo("anthropic/claude-2"));
45+
});
46+
}
2247
}

src/AssemblyAI/AssemblyAI.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<RootNamespace>AssemblyAI</RootNamespace>
1010
<AssemblyName>AssemblyAI</AssemblyName>
1111
<PackageId>AssemblyAI</PackageId>
12-
<Version>1.1.4</Version>
13-
<AssemblyVersion>1.1.4.0</AssemblyVersion>
14-
<FileVersion>1.1.4.0</FileVersion>
15-
<PackageVersion>1.1.4</PackageVersion>
12+
<Version>1.2.0</Version>
13+
<AssemblyVersion>1.2.0.0</AssemblyVersion>
14+
<FileVersion>1.2.0.0</FileVersion>
15+
<PackageVersion>1.2.0</PackageVersion>
1616
<Title>AssemblyAI C# .NET SDK</Title>
1717
<Authors>AssemblyAI</Authors>
1818
<Description>The AssemblyAI C# .NET SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, audio intelligence models, as well as the latest LeMUR models.</Description>

src/AssemblyAI/Core/CustomConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ internal static class CustomConstants
66
/// This is used for the AssemblyAI User-Agent.
77
/// If you update this, make sure to also update the version numbers in AssemblyAI.csproj
88
/// </summary>
9-
internal const string Version = "1.1.4";
9+
internal const string Version = "1.2.0";
1010
}

src/AssemblyAI/Core/StringEnumSerializer.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ public StringEnumSerializer()
2929
?? value.ToString()
3030
?? throw new Exception("Unexpected null enum toString value");
3131

32-
_enumToString.Add(enumValue, stringValue);
33-
_stringToEnum.Add(stringValue, enumValue);
32+
if(!_enumToString.ContainsKey(enumValue))
33+
{
34+
_enumToString.Add(enumValue, stringValue);
35+
}
36+
37+
if (!_stringToEnum.ContainsKey(stringValue))
38+
{
39+
_stringToEnum.Add(stringValue, enumValue);
40+
}
3441
}
3542
}
3643

src/AssemblyAI/Lemur/LemurClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal LemurClient(RawClient client)
2828
/// {
2929
/// TranscriptIds = new List<string>() { "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce" },
3030
/// Context = "This is an interview about wildfires.",
31-
/// FinalModel = LemurModel.Default,
31+
/// FinalModel = LemurModel.AnthropicClaude35Sonnet,
3232
/// MaxOutputSize = 3000,
3333
/// Temperature = 0f,
3434
/// Prompt = "List all the locations affected by wildfires.",
@@ -84,7 +84,7 @@ public async Task<LemurTaskResponse> TaskAsync(
8484
/// {
8585
/// TranscriptIds = new List<string>() { "47b95ba5-8889-44d8-bc80-5de38306e582" },
8686
/// Context = "This is an interview about wildfires.",
87-
/// FinalModel = LemurModel.Default,
87+
/// FinalModel = LemurModel.AnthropicClaude35Sonnet,
8888
/// MaxOutputSize = 3000,
8989
/// Temperature = 0f,
9090
/// }
@@ -139,7 +139,7 @@ public async Task<LemurSummaryResponse> SummaryAsync(
139139
/// {
140140
/// TranscriptIds = new List<string>() { "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce" },
141141
/// Context = "This is an interview about wildfires.",
142-
/// FinalModel = LemurModel.Default,
142+
/// FinalModel = LemurModel.AnthropicClaude35Sonnet,
143143
/// MaxOutputSize = 3000,
144144
/// Temperature = 0f,
145145
/// Questions = new List<LemurQuestion>()
@@ -207,7 +207,7 @@ public async Task<LemurQuestionAnswerResponse> QuestionAnswerAsync(
207207
/// {
208208
/// TranscriptIds = new List<string>() { "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce" },
209209
/// Context = "This is an interview about wildfires.",
210-
/// FinalModel = LemurModel.Default,
210+
/// FinalModel = LemurModel.AnthropicClaude35Sonnet,
211211
/// MaxOutputSize = 3000,
212212
/// Temperature = 0f,
213213
/// AnswerFormat = "Bullet Points",

src/AssemblyAI/Lemur/Types/LemurModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public enum LemurModel
2525
AnthropicClaude2_1,
2626

2727
[EnumMember(Value = "anthropic/claude-2")]
28+
AnthropicClaude2_0,
29+
30+
[EnumMember(Value = "anthropic/claude-2")]
31+
[Obsolete("Use AnthropicClaude2_0")]
2832
AnthropicClaude2,
2933

3034
[EnumMember(Value = "default")]

src/AssemblyAI/Transcripts/Requests/ListTranscriptParams.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public record ListTranscriptParams
99
/// <summary>
1010
/// Maximum amount of transcripts to retrieve
1111
/// </summary>
12-
public long? Limit { get; set; }
12+
public int? Limit { get; set; }
1313

1414
/// <summary>
1515
/// Filter by transcript status

src/AssemblyAI/Transcripts/Requests/TranscriptParams.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,22 @@ public record TranscriptParams
5151
[JsonPropertyName("disfluencies")]
5252
public bool? Disfluencies { get; set; }
5353

54+
/// <summary>
55+
/// Enable [Multichannel](https://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) transcription, can be true or false.
56+
/// </summary>
57+
[JsonPropertyName("multichannel")]
58+
public bool? Multichannel { get; set; }
59+
5460
/// <summary>
5561
/// Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
5662
/// </summary>
5763
[JsonPropertyName("dual_channel")]
5864
public bool? DualChannel { get; set; }
5965

6066
/// <summary>
61-
/// The URL to which we send webhook requests. We sends two different types of webhook requests. One request when a transcript is completed or failed, and one request when the redacted audio is ready if redact_pii_audio is enabled.
67+
/// The URL to which we send webhook requests.
68+
/// We sends two different types of webhook requests.
69+
/// One request when a transcript is completed or failed, and one request when the redacted audio is ready if redact_pii_audio is enabled.
6270
/// </summary>
6371
[JsonPropertyName("webhook_url")]
6472
public string? WebhookUrl { get; set; }

0 commit comments

Comments
 (0)