Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ await liveClient.Connect(new LiveSchema()

## Key params

REST (`PreRecordedSchema`): `Summarize`, `Topics`, `Intents`, `Sentiment`, `DetectLanguage`, `DetectEntities`, `CustomTopic`, `CustomTopicMode`, `CustomIntent`, `CustomIntentMode`, `Diarize`, `DiarizeVersion`, `Redact`, `Utterances`, plus the regular STT knobs.
REST (`PreRecordedSchema`): `Summarize`, `Topics`, `Intents`, `Sentiment`, `DetectLanguage`, `DetectEntities`, `CustomTopic`, `CustomTopicMode`, `CustomIntent`, `CustomIntentMode`, `Diarize`, `DiarizeVersion`, `DiarizeModel`, `Redact`, `Utterances`, plus the regular STT knobs.

Live (`LiveSchema`): `Diarize`, `Redact`, `UtteranceEnd`, `VadEvents`, `Punctuate`, `SmartFormat`, plus normal streaming STT settings.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,36 @@ public void GetParameters_Should_Return_Empty_String_When_Parameter_Has_No_Value
result.Should().Be($"https://{Defaults.DEFAULT_URI}");
}

// DiarizeModel surfaces Batch Diarization v2; the API spec enum is latest, v1, v2.
[TestCase("v2")]
[TestCase("v1")]
[TestCase("latest")]
public void GetParameters_Should_Return_String_When_Passing_DiarizeModel_Parameter(string diarizeModel)
{
// Input and Output
var obj = new Deepgram.Models.Listen.v1.REST.PreRecordedSchema() { DiarizeModel = diarizeModel };
var expected = $"diarize_model={diarizeModel}";

//Act
var result = QueryParameterUtil.FormatURL(Defaults.DEFAULT_URI, obj);

//Assert
result.Should().NotBeNull();
result.Should().Contain(expected);
}

[Test]
public void GetParameters_Should_Omit_DiarizeModel_When_Not_Set()
{
// Input and Output - additive/non-breaking: absent unless explicitly set
var obj = new Deepgram.Models.Listen.v1.REST.PreRecordedSchema() { Model = "nova-2" };

//Act
var result = QueryParameterUtil.FormatURL(Defaults.DEFAULT_URI, obj);

//Assert
result.Should().NotBeNull();
result.Should().NotContain("diarize_model");
}

}
11 changes: 11 additions & 0 deletions Deepgram/Models/Listen/v1/REST/PreRecordedSchema.cs
Comment thread
dg-coreylweathers marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ public class PreRecordedSchema
[JsonPropertyName("diarize")]
public bool? Diarize { get; set; }

/// <summary>
/// Select and enable a specific batch diarization model version, e.g. "latest", "v1", or "v2".
/// Supersedes the deprecated <see cref="Diarize"/> boolean; if set, do not also set Diarize.
/// Batch/pre-recorded only - not accepted on streaming requests.
/// <see href="https://developers.deepgram.com/docs/diarization">
/// default is null
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("diarize_model")]
public string? DiarizeModel { get; set; }

// <summary>
/// <see href="https://developers.deepgram.com/docs/diarization">
/// default is null, only applies if Diarize is set to true
Expand Down
1 change: 1 addition & 0 deletions Deepgram/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ also see [TranscribeSchema] which LiveSchema is derived from for more options
| Callback | string? | Callback URL to provide if you would like your submitted audio to be processed asynchronously |
| Diarize | bool? | Indicates whether to recognize speaker changes |
| DiarizeVersion | string? | |
| DiarizeModel | string? | Batch diarization model version to use (latest, v1, v2). Supersedes the deprecated Diarize boolean |
| Extra | Dictonary<string,string>? | additonal values you want echoing bac | |
| FillerWords | int? | Whether to include words like "uh" and "um" in transcription output. |
| Keywords | List<string>? | Keywords to which the model should pay particular attention to boosting or suppressing to help it understand context |
Expand Down
Loading