Skip to content

Commit

Permalink
Merge pull request #205 from dvonthenen/audit-live-model
Browse files Browse the repository at this point in the history
Audit of Live Model Classes
  • Loading branch information
dvonthenen authored Feb 5, 2024
2 parents ca5db4c + 0a67e06 commit 1b8b027
Show file tree
Hide file tree
Showing 22 changed files with 227 additions and 376 deletions.
4 changes: 1 addition & 3 deletions Deepgram/Models/Live/v1/Alternative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ public record Alternative
/// Value between 0 and 1 indicating the model's relative confidence in this transcript.
/// </summary>
[JsonPropertyName("confidence")]
public decimal? Confidence { get; set; }
public double? Confidence { get; set; }

/// <summary>
/// ReadOnly List of <see cref="Word"/> objects.
/// </summary>
[JsonPropertyName("words")]
public IReadOnlyList<Word>? Words { get; set; }


}
6 changes: 6 additions & 0 deletions Deepgram/Models/Live/v1/Average.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

public class Average
{
/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("sentiment")]
public string? Sentiment { get; set; }

/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("sentiment_score")]
public double? SentimentScore { get; set; }
}
6 changes: 0 additions & 6 deletions Deepgram/Models/Live/v1/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,4 @@ public record Channel
/// </summary>
[JsonPropertyName("alternatives")]
public IReadOnlyList<Alternative>? Alternatives { get; set; }

/// <summary>
/// <see cref="Search"/>
/// </summary>
[JsonPropertyName("search")]
public IReadOnlyList<Search>? Searches { get; set; }
}
4 changes: 4 additions & 0 deletions Deepgram/Models/Live/v1/EventResponse.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
namespace Deepgram.Models.Live.v1;

public class EventResponse
{
/// <summary>
/// MetaData response from the live transcription service
/// </summary>
public MetadataResponse? MetaData { get; set; }

/// <summary>
/// Transcription response from the live transcription service
/// </summary>
public TranscriptionResponse? Transcription { get; set; }

/// <summary>
/// UtterancEnd response from the live transcription service
/// </summary>
public UtteranceEndResponse? UtteranceEnd { get; set; }

/// <summary>
/// Error response from the live transcription service
/// </summary>
Expand Down
24 changes: 0 additions & 24 deletions Deepgram/Models/Live/v1/Hit.cs

This file was deleted.

18 changes: 0 additions & 18 deletions Deepgram/Models/Live/v1/Intent.cs

This file was deleted.

29 changes: 0 additions & 29 deletions Deepgram/Models/Live/v1/IntentSegment.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Deepgram/Models/Live/v1/Intents.cs

This file was deleted.

135 changes: 47 additions & 88 deletions Deepgram/Models/Live/v1/LiveSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@ public class LiveSchema
[JsonPropertyName("callback_method")]
public bool? CallbackMethod { get; set; }

///// <summary>
///// Optional. A custom intent you want the model to detect within your input audio if present. Submit up to 100.
///// </summary>
//[JsonPropertyName("custom_intent")]
//public string CustomIntent { get; set; }

///// <summary>
///// Optional. Sets how the model will interpret strings submitted to the custom_intent param. When "strict", the model will only return intents submitted using the custom_intent param. When "extended", the model will return it's own detected intents in addition those submitted using the custom_intents param.
///// </summary>
//[JsonPropertyName("custom_intent_mode")]
//public string CustomIntentMode { get; set; }

/// <summary>
/// Channels allows you to specify the number of independent audio channels your submitted audio contains.
/// Used when the Encoding feature is also being used to submit streaming raw audio
/// <see href="https://developers.deepgram.com/docs/channels">
/// </summary>
[JsonPropertyName("channels")]
public int? Channels { get; set; }

/// <summary>
/// Diarize recognizes speaker changes and assigns a speaker to each word in the transcript.
Expand All @@ -53,14 +48,28 @@ public class LiveSchema
[JsonPropertyName("diarize_version")]
public string? DiarizeVersion { get; set; }

/// <summary>
/// Encoding allows you to specify the expected encoding of your submitted audio.
/// <see href="https://developers.deepgram.com/docs/encoding">
/// supported encodings <see cref="AudioEncoding"/>
/// </summary>
[JsonPropertyName("encoding")]
public string? Encoding { get; set; }

/// <summary>
/// Endpointing returns transcripts when pauses in speech are detected.
/// <see href="https://developers.deepgram.com/docs/endpointing">
/// </summary>
[JsonPropertyName("endpointing")]
public string? EndPointing { get; set; }

/// <summary>
/// Deepgram’s Extra Metadata feature allows you to attach arbitrary key-value pairs to your API requests that are attached to the API response for usage in downstream processing.
/// Extra metadata is limited to 2048 characters per key-value pair.
/// <see href="https://developers.deepgram.com/docs/extra-metadata"/>
/// </summary>
[JsonPropertyName("extra")]
public Dictionary<string, string> Extra { get; set; }

public Dictionary<string, string>? Extra { get; set; }

/// <summary>
/// Whether to include words like "uh" and "um" in transcription output.
Expand All @@ -69,11 +78,12 @@ public class LiveSchema
[JsonPropertyName("filler_words")]
public bool? FillerWords { get; set; }

///// <summary>
///// Enables intent recognition
///// </summary>
//[JsonPropertyName("intents")]
//public bool? Intents { get; set; }
/// <summary>
/// Interim Results provides preliminary results for streaming audio to solve the need for immediate results combined with high levels of accuracy.
/// <see href="https://developers.deepgram.com/docs/interim-results">
/// </summary>
[JsonPropertyName("interim_results")]
public bool? InterimResults { get; set; }

/// <summary>
/// Keywords can boost or suppress specialized terminology.
Expand Down Expand Up @@ -137,6 +147,14 @@ public class LiveSchema
[JsonPropertyName("replace")]
public List<string>? Replace { get; set; }

/// <summary>
/// Sample Rate allows you to specify the sample rate of your submitted audio.
/// <see href="https://developers.deepgram.com/docs/sample-rate">
/// only applies when Encoding has a value
/// </summary>
[JsonPropertyName("sample_rate")]
public int? SampleRate { get; set; }

/// <summary>
/// Search searches for terms or phrases in submitted audio.
/// <see href="https://developers.deepgram.com/docs/search">
Expand All @@ -145,15 +163,6 @@ public class LiveSchema
[JsonPropertyName("search")]
public List<string>? Search { get; set; }

///// <summary>
///// Enables sentiment analysis false by default
///// </summary>
//[JsonPropertyName("sentiment")]
//public bool? Sentiment { get; set; }

//[JsonPropertyName("sentiment_threshold")]
//public double? SentimentThreshold { get; set; }

/// <summary>
/// Smart Format formats transcripts to improve readability.
/// <see href="https://developers.deepgram.com/docs/smart-format">
Expand All @@ -169,63 +178,6 @@ public class LiveSchema
[JsonPropertyName("tag")]
public List<string>? Tag { get; set; }

///// <summary>
///// Level of model you would like to use in your request.
///// <see href="https://developers.deepgram.com/docs/model">
///// </summary>
//[JsonPropertyName("tier")]
//[Obsolete("Use Model with joint model syntax https://developers.deepgram.com/docs/models-languages-overview")]
//public string? Tier { get; set; }

/// <summary>
/// Version of the model to use.
/// <see href="https://developers.deepgram.com/docs/version">
/// default value is "latest"
/// </summary>
[JsonPropertyName("version")]
public string? Version { get; set; }

/// <summary>
/// Channels allows you to specify the number of independent audio channels your submitted audio contains.
/// Used when the Encoding feature is also being used to submit streaming raw audio
/// <see href="https://developers.deepgram.com/docs/channels">
/// </summary>
[JsonPropertyName("channels")]
public int? Channels { get; set; }

/// <summary>
/// Encoding allows you to specify the expected encoding of your submitted audio.
/// <see href="https://developers.deepgram.com/docs/encoding">
/// supported encodings <see cref="AudioEncoding"/>
/// </summary>
[JsonPropertyName("encoding")]
public string? Encoding { get; set; }

/// <summary>
/// Endpointing returns transcripts when pauses in speech are detected.
/// <see href="https://developers.deepgram.com/docs/endpointing">
/// </summary>
[JsonPropertyName("endpointing")]
public string? EndPointing { get; set; }

/// <summary>
/// Interim Results provides preliminary results for streaming audio to solve the need for immediate results combined with high levels of accuracy.
/// <see href="https://developers.deepgram.com/docs/interim-results">
/// </summary>
[JsonPropertyName("interim_results")]
public bool? InterimResults { get; set; }

[JsonPropertyName("numerals")]
[Obsolete("Replaced with SmartFormat")]
public bool? Numerals { get; set; }
/// <summary>
/// Sample Rate allows you to specify the sample rate of your submitted audio.
/// <see href="https://developers.deepgram.com/docs/sample-rate">
/// only applies when Encoding has a value
/// </summary>
[JsonPropertyName("sample_rate")]
public int? SampleRate { get; set; }

/// <summary>
/// Indicates how long Deepgram will wait to send a {"type": "UtteranceEnd"} message after a word has been transcribed
/// <see href="https://developers.deepgram.com/docs/understanding-end-of-speech-detection-while-streaming"/>
Expand All @@ -234,9 +186,16 @@ public class LiveSchema
public int? UtteranceEnd { get; set; }

/// <summary>
/// This is achieved through a Voice Activity Detector (VAD), which gauges the tonal nuances of human speech and can better differentiate between silent and non-silent audio.
/// <see href="https://developers.deepgram.com/docs/start-of-speech-detection"/>
/// TODO
/// </summary>
[JsonPropertyName("vad_events")]
public bool? DetectSpeechStart { get; set; }
public int? VadEvents { get; set; }

/// <summary>
/// Version of the model to use.
/// <see href="https://developers.deepgram.com/docs/version">
/// default value is "latest"
/// </summary>
[JsonPropertyName("version")]
public string? Version { get; set; }
}
43 changes: 22 additions & 21 deletions Deepgram/Models/Live/v1/Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@

public record MetaData
{
[JsonPropertyName("type")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public LiveType Type { get; set; } = LiveType.Metadata;

[JsonPropertyName("transaction_key")]
public string? TransactionKey { get; set; }

/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("request_id")]
public string? RequestId { get; set; }

[JsonPropertyName("sha256")]
public string? Sha256 { get; set; }

[JsonPropertyName("created")]
public DateTime? Created { get; set; }

[JsonPropertyName("duration")]
public double? Duration { get; set; }

[JsonPropertyName("channels")]
public int? Channels { get; set; }

[JsonPropertyName("models")]
public IReadOnlyList<string> Models { get; set; }
/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("model_uuid")]
public string? ModelUUID { get; set; }

/// <summary>
/// IReadonlyDictionary of <see cref="ModelInfo"/>
/// </summary>
[JsonPropertyName("model_info")]
public Dictionary<string, ModelInfo> ModelInfo { get; set; }

/// <summary>
/// Deepgram’s Extra Metadata feature allows you to attach arbitrary key-value pairs to your API requests that are attached to the API response for usage in downstream processing.
/// Extra metadata is limited to 2048 characters per key-value pair.
/// <see href="https://developers.deepgram.com/docs/extra-metadata"/>
/// </summary>
[JsonPropertyName("extra")]
public Dictionary<string, string>? Extra { get; set; }
}
Loading

0 comments on commit 1b8b027

Please sign in to comment.