Skip to content

Commit

Permalink
Audit of PreRecorded Model Classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvonthenen committed Feb 3, 2024
1 parent f34d01a commit 646b253
Show file tree
Hide file tree
Showing 33 changed files with 573 additions and 412 deletions.
33 changes: 16 additions & 17 deletions Deepgram/Models/PreRecorded/v1/Alternative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,54 @@ public record Alternative
/// <summary>
/// Value between 0 and 1 indicating the model's relative confidence in this transcript.
/// </summary>
[JsonPropertyName("confidence")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("confidence")]
public decimal? Confidence { get; set; }

/// <summary>
/// ReadOnlyList of <see cref="Entity"/> objects.
/// </summary>
/// <remark>Only used when the detect entities feature is enabled on the request</remark>
[JsonPropertyName("entities")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("entities")]
public IReadOnlyList<Entity>? Entities { get; set; }

/// <summary>
/// ReadOnly List of <see cref="ParagraphGroup"/> containing separated transcript and <see cref="Paragraph"/> objects.
/// </summary>
/// <remark>Only used when the paragraph feature is enabled on the request</remark>
[JsonPropertyName("paragraphs")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("paragraphs")]
public ParagraphGroup? Paragraphs { get; set; }

/// <summary>
/// ReadOnly List of <see cref="Summary "/> objects.
/// </summary>
/// <remark>Only used when the summarize feature is enabled on the request</remark>
[JsonPropertyName("summaries")]
public IReadOnlyList<Summary>? Summaries { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("summaries")]
public IReadOnlyList<SummaryObsolete>? Summaries { get; set; }

/// <summary>
/// Single-string transcript containing what the model hears in this channel of audio.
/// </summary>
[JsonPropertyName("transcript")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("transcript")]
public string? Transcript { get; set; }


/// <summary>
/// ReadOnlyList of <see cref="Translation"/> objects.
/// </summary>
/// <remark>Only used when the translation feature is enabled on the request</remark>
[JsonPropertyName("translations")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("translations")]
public IReadOnlyList<Translation>? Translations { get; set; }

/// <summary>
/// Group of Topics<see cref="TopicGroup"/>
/// </summary>
[JsonPropertyName("topics")]
public IReadOnlyList<TopicGroup>? Topics { get; set; }

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

[JsonPropertyName("sentiment_segments")]
public List<SentimentSegment>? SentimentSegments { get; set; }
}
12 changes: 10 additions & 2 deletions Deepgram/Models/PreRecorded/v1/Average.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

public class Average
{
[JsonPropertyName("sentiment")]
/// <summary>
/// TODO
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("sentiment")]
public string? Sentiment { get; set; }

[JsonPropertyName("sentiment_score")]
/// <summary>
/// TODO
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("sentiment_score")]
public double? SentimentScore { get; set; }
}
14 changes: 9 additions & 5 deletions Deepgram/Models/PreRecorded/v1/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@ public record Channel
/// <summary>
/// ReadOnlyList of <see cref="Alternative"/> objects.
/// </summary>
[JsonPropertyName("alternatives")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("alternatives")]
public IReadOnlyList<Alternative>? Alternatives { get; set; }

/// <summary>
/// BCP-47 language tag for the dominant language identified in the channel.
/// </summary>
/// <remark>Only available in pre-recorded requests</remark>
[JsonPropertyName("detected_language")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("detected_language")]
public string? DetectedLanguage { get; set; }


[JsonPropertyName("language_confidence")]
public double? LanguageConfidence { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("language_confidence")]
public decimal? LanguageConfidence { get; set; }

/// <summary>
/// ReadOnlyList of Search objects.
/// </summary>
[JsonPropertyName("search")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("search")]
public IReadOnlyList<Search>? Search { get; set; }
}
15 changes: 10 additions & 5 deletions Deepgram/Models/PreRecorded/v1/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,35 @@ public record Entity
/// This is the type of the entity
/// </summary>
/// <remarks>e.g. DATE, PER, ORG, etc.</remarks>
[JsonPropertyName("label")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("label")]
public string? Label { get; set; }

/// <summary>
/// This is the value of the detected entity.
/// </summary>
[JsonPropertyName("value")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("value")]
public string? Value { get; set; }

/// <summary>
/// Starting index of the entities words within the transcript.
/// </summary>
[JsonPropertyName("start_word")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("start_word")]
public int? StartWord { get; set; }

/// <summary>
/// Ending index of the entities words within the transcript.
/// </summary>
[JsonPropertyName("end_word")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("end_word")]
public int? EndWord { get; set; }

/// <summary>
/// Value between 0 and 1 indicating the model's relative confidence in this detected entity.
/// </summary>
[JsonPropertyName("confidence")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("confidence")]
public decimal? Confidence { get; set; }
}
12 changes: 8 additions & 4 deletions Deepgram/Models/PreRecorded/v1/Hit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,30 @@ public record Hit
/// <summary>
/// Value between 0 and 1 that indicates the model's relative confidence in this hit.
/// </summary>
[JsonPropertyName("confidence")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("confidence")]
public decimal Confidence { get; set; }


/// <summary>
/// Offset in seconds from the start of the audio to where the hit ends.
/// </summary>
[JsonPropertyName("end")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("end")]
public decimal End { get; set; }

/// <summary>
/// Transcript that corresponds to the time between start and end.
/// </summary>
[JsonPropertyName("snippet")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("snippet")]
public string Snippet { get; set; }

/// <summary>
/// Offset in seconds from the start of the audio to where the hit occurs.
/// </summary>
[JsonPropertyName("start")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("start")]
public decimal Start { get; set; }

}
9 changes: 6 additions & 3 deletions Deepgram/Models/PreRecorded/v1/Intent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ public record Intent
/// <summary>
/// <see href="https://developers.deepgram.com/reference/audio-intelligence-apis#intent-recognition"/>
/// </summary>
[JsonPropertyName("intent")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("intent")]
public string Intention { get; set; }

/// <summary>
/// <see href="https://developers.deepgram.com/reference/audio-intelligence-apis#intent-recognition"/>
/// </summary>
[JsonPropertyName("confidence_score")]
public double ConfidenceScore { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("confidence_score")]
public decimal ConfidenceScore { get; set; }
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace Deepgram.Models.PreRecorded.v1;
public record Intents

public record IntentGroup
{
/// <summary>
/// <see href="https://developers.deepgram.com/reference/audio-intelligence-apis#intent-recognition"/>
/// <see cref="IntentSegment"/>
/// </summary>
[JsonPropertyName("segments")]
public IReadOnlyList<IntentSegment>? Segments { get; set; }

}
18 changes: 12 additions & 6 deletions Deepgram/Models/PreRecorded/v1/IntentsInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

public record IntentsInfo
{
/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("input_tokens")]
public int InputTokens { get; set; }

/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("model_uuid")]
public string ModelUuid { get; set; }


[JsonPropertyName("input_tokens")]
public int? InputTokens { get; set; }


/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("output_tokens")]
public int? OutputTokens { get; set; }
public int OutputTokens { get; set; }
}


72 changes: 51 additions & 21 deletions Deepgram/Models/PreRecorded/v1/Metadata.cs
Original file line number Diff line number Diff line change
@@ -1,69 +1,99 @@
namespace Deepgram.Models.PreRecorded.v1;
public record Metadata
{
/// <summary>
/// Number of channels detected in the submitted audio.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("channels")]
public int? Channels { get; set; }

/// <summary>
/// Timestamp that indicates when the audio was submitted.
/// </summary>
[JsonPropertyName("created")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("created")]
public DateTime? Created { get; set; }

/// <summary>
/// Number of channels detected in the submitted audio.
/// Duration in seconds of the submitted audio.
/// </summary>
[JsonPropertyName("channels")]
public int? Channels { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("duration")]
public double? Duration { get; set; }

/// <summary>
/// Duration in seconds of the submitted audio.
/// 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("duration")]
public double? Duration { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("extra")]
public Dictionary<string, string> Extra { get; set; }

/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("intents_info")]
public IntentsInfo IntentsInfo { get; set; }

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


[JsonPropertyName("models")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("models")]
public List<string>? Models { get; set; }

/// <summary>
/// Unique identifier for the submitted audio and derived data returned.
/// </summary>
[JsonPropertyName("request_id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("request_id")]
public string? RequestId { get; set; }

/// <summary>
/// TODO.
/// </summary>
[JsonPropertyName("sentiment_info")]
public SentimentInfo SentimentInfo { get; set; }

/// <summary>
/// SHA-256 hash of the submitted audio data.
/// </summary>
[JsonPropertyName("sha256")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("sha256")]
public string? Sha256 { get; set; }

/// <summary>
/// Tags relating to the project
/// TODO
/// </summary>
public List<string>? Tags { get; set; }
[JsonPropertyName("summary_info")]
public SummaryInfo SummaryInfo { get; set; }

/// <summary>
/// TODO
/// </summary>
[JsonPropertyName("topics_info")]
public TopicsInfo TopicsInfo { get; set; }

/// <summary>
/// Blob of text that helps Deepgram engineers debug any problems you encounter.
/// </summary>
[JsonPropertyName("transaction_key")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("transaction_key")]
[Obsolete("phasing out")]
public string? TransactionKey { get; set; }

[JsonPropertyName("sentiment_info")]
public SentimentInfo SentimentInfo { get; set; }

[JsonPropertyName("intents_info")]
public IntentsInfo IntentsInfo { get; set; }

/// <summary>
/// Warnings to provide feedback about unsupported and deprecated queries.
/// </summary>
[JsonPropertyName("warnings")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("warnings")]
public List<Warning>? Warnings { get; set; }


Expand Down
Loading

0 comments on commit 646b253

Please sign in to comment.