-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #324 from ElliotEserin/ws-listen-search-property
Add Search to Listen.V1.WebSocket.Channel model
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
|