@@ -7,60 +7,61 @@ namespace AssemblyAI.UnitTests;
77[ TestFixture ]
88public class TranscriptParamsTests
99{
10+ private static TranscriptOptionalParams _optionalParams = new ( )
11+ {
12+ LanguageCode = TranscriptLanguageCode . En ,
13+ LanguageDetection = true ,
14+ LanguageConfidenceThreshold = 0.9f ,
15+ SpeechModel = SpeechModel . Best ,
16+ Punctuate = true ,
17+ FormatText = true ,
18+ Disfluencies = true ,
19+ DualChannel = true ,
20+ WebhookUrl = "https://example.com/webhook" ,
21+ WebhookAuthHeaderName = "Webhook-Authorization" ,
22+ WebhookAuthHeaderValue = "passwords" ,
23+ AutoHighlights = true ,
24+ AudioStartFrom = 10 ,
25+ AudioEndAt = 360 ,
26+ WordBoost = [ "word" ] ,
27+ BoostParam = TranscriptBoostParam . Default ,
28+ FilterProfanity = true ,
29+ RedactPii = true ,
30+ RedactPiiAudio = true ,
31+ RedactPiiAudioQuality = RedactPiiAudioQuality . Mp3 ,
32+ RedactPiiPolicies = [ PiiPolicy . Date , PiiPolicy . Drug ] ,
33+ RedactPiiSub = SubstitutionPolicy . Hash ,
34+ SpeakerLabels = true ,
35+ SpeakersExpected = 4 ,
36+ ContentSafety = true ,
37+ ContentSafetyConfidence = 90 ,
38+ IabCategories = true ,
39+ CustomSpelling =
40+ [
41+ new TranscriptCustomSpelling
42+ {
43+ From = [ "from" ] ,
44+ To = "to"
45+ }
46+ ] ,
47+ SentimentAnalysis = true ,
48+ AutoChapters = true ,
49+ EntityDetection = true ,
50+ SpeechThreshold = 0.9f ,
51+ Summarization = true ,
52+ SummaryModel = SummaryModel . Catchy ,
53+ SummaryType = SummaryType . Bullets ,
54+ CustomTopics = true ,
55+ Topics = [ "topic" ]
56+ } ;
57+
1058 [ Test ]
1159 public void ShouldMapOptionalToTranscriptParams ( )
1260 {
13- var optionalParams = new TranscriptOptionalParams
14- {
15- LanguageCode = TranscriptLanguageCode . En ,
16- LanguageDetection = true ,
17- LanguageConfidenceThreshold = 0.9f ,
18- SpeechModel = SpeechModel . Best ,
19- Punctuate = true ,
20- FormatText = true ,
21- Disfluencies = true ,
22- DualChannel = true ,
23- WebhookUrl = "https://example.com/webhook" ,
24- WebhookAuthHeaderName = "Webhook-Authorization" ,
25- WebhookAuthHeaderValue = "passwords" ,
26- AutoHighlights = true ,
27- AudioStartFrom = 10 ,
28- AudioEndAt = 360 ,
29- WordBoost = [ "word" ] ,
30- BoostParam = TranscriptBoostParam . Default ,
31- FilterProfanity = true ,
32- RedactPii = true ,
33- RedactPiiAudio = true ,
34- RedactPiiAudioQuality = RedactPiiAudioQuality . Mp3 ,
35- RedactPiiPolicies = [ PiiPolicy . Date , PiiPolicy . Drug ] ,
36- RedactPiiSub = SubstitutionPolicy . Hash ,
37- SpeakerLabels = true ,
38- SpeakersExpected = 4 ,
39- ContentSafety = true ,
40- ContentSafetyConfidence = 90 ,
41- IabCategories = true ,
42- CustomSpelling =
43- [
44- new TranscriptCustomSpelling
45- {
46- From = [ "from" ] ,
47- To = "to"
48- }
49- ] ,
50- SentimentAnalysis = true ,
51- AutoChapters = true ,
52- EntityDetection = true ,
53- SpeechThreshold = 0.9f ,
54- Summarization = true ,
55- SummaryModel = SummaryModel . Catchy ,
56- SummaryType = SummaryType . Bullets ,
57- CustomTopics = true ,
58- Topics = [ "topic" ]
59- } ;
6061 const string audioUrl = "https://example.com/audio.mp3" ;
61- var transcriptParams = optionalParams . ToTranscriptParams ( audioUrl ) ;
62+ var transcriptParams = _optionalParams . ToTranscriptParams ( audioUrl ) ;
6263
63- var optionalParamsJson = JsonSerializer . SerializeToElement ( optionalParams ) ;
64+ var optionalParamsJson = JsonSerializer . SerializeToElement ( _optionalParams ) ;
6465 var transcriptParamsJson = JsonSerializer . SerializeToElement ( transcriptParams ) ;
6566 foreach ( var key in optionalParamsJson . EnumerateObject ( ) )
6667 {
@@ -70,4 +71,13 @@ public void ShouldMapOptionalToTranscriptParams()
7071 ) ;
7172 }
7273 }
74+
75+ [ Test ]
76+ public void ShouldClone ( )
77+ {
78+ var clonedParams = _optionalParams . Clone ( ) ;
79+ var paramsJson = JsonSerializer . Serialize ( _optionalParams ) ;
80+ var cloneJson = JsonSerializer . Serialize ( clonedParams ) ;
81+ Assert . That ( paramsJson , Is . EqualTo ( cloneJson ) ) ;
82+ }
7383}
0 commit comments