Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Search to Listen.V1.WebSocket.Channel model #324

Merged
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
7 changes: 7 additions & 0 deletions Deepgram/Models/Listen/v1/WebSocket/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public record Channel
[JsonPropertyName("alternatives")]
public IReadOnlyList<Alternative>? Alternatives { get; set; }

/// <summary>
/// ReadOnlyList of Search objects.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("search")]
public IReadOnlyList<Search>? Search { get; set; }

/// <summary>
/// Override ToString method to serialize the object
/// </summary>
Expand Down
45 changes: 45 additions & 0 deletions Deepgram/Models/Listen/v1/WebSocket/Hit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2021-2024 Deepgram .NET SDK contributors. All Rights Reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT

namespace Deepgram.Models.Listen.v1.WebSocket;

public record Hit
{
/// <summary>
/// Value between 0 and 1 that indicates the model's relative confidence in this hit.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("confidence")]
public double? Confidence { get; set; }


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

/// <summary>
/// Transcript that corresponds to the time between start and end.
/// </summary>
[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>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("start")]
public decimal? Start { get; set; }

/// <summary>
/// Override ToString method to serialize the object
/// </summary>
public override string ToString()
{
return Regex.Unescape(JsonSerializer.Serialize(this, JsonSerializeOptions.DefaultOptions));
}
}
31 changes: 31 additions & 0 deletions Deepgram/Models/Listen/v1/WebSocket/Search.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2021-2024 Deepgram .NET SDK contributors. All Rights Reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT

namespace Deepgram.Models.Listen.v1.WebSocket;

public record Search
{
/// <summary>
/// Term for which Deepgram is searching.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("query")]
public string? Query { get; set; }

/// <summary>
/// ReadonlyList of <see cref="Hit"/>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("hits")]
public IReadOnlyList<Hit>? Hits { get; set; }

/// <summary>
/// Override ToString method to serialize the object
/// </summary>
public override string ToString()
{
return Regex.Unescape(JsonSerializer.Serialize(this, JsonSerializeOptions.DefaultOptions));
}
}

Loading