Skip to content

Commit db4d22e

Browse files
committed
fix: examples work again
1 parent 3f96858 commit db4d22e

File tree

5 files changed

+31
-43
lines changed

5 files changed

+31
-43
lines changed

Deepgram/Models/Agent/v2/WebSocket/ListenProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public record ListenProvider
1111
/// </summary>
1212
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1313
[JsonPropertyName("type")]
14-
public string? Type { get; set; };
14+
public string? Type { get; set; }
1515

1616
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1717
[JsonPropertyName("model")]
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
2-
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
3-
// SPDX-License-Identifier: MIT
4-
5-
namespace Deepgram.Models.Agent.v2.WebSocket;
6-
7-
public record WelcomeResponse
8-
{
9-
/// <summary>
10-
/// SettingsConfiguration event type.
11-
/// </summary>
12-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
13-
[JsonPropertyName("type")]
14-
[JsonConverter(typeof(JsonStringEnumConverter))]
15-
public AgentType? Type { get; } = AgentType.Welcome;
16-
17-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
18-
[JsonPropertyName("session_id")]
19-
public string? SessionId { get; set; }
20-
21-
/// <summary>
22-
/// Override ToString method to serialize the object
23-
/// </summary>
24-
public override string ToString()
25-
{
26-
return Regex.Unescape(JsonSerializer.Serialize(this, JsonSerializeOptions.DefaultOptions));
27-
}
28-
}
1+
// Copyright 2024 Deepgram .NET SDK contributors. All Rights Reserved.
2+
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
3+
// SPDX-License-Identifier: MIT
4+
5+
namespace Deepgram.Models.Agent.v2.WebSocket;
6+
7+
public record WelcomeResponse
8+
{
9+
/// <summary>
10+
/// SettingsConfiguration event type.
11+
/// </summary>
12+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
13+
[JsonPropertyName("type")]
14+
[JsonConverter(typeof(JsonStringEnumConverter))]
15+
public AgentType? Type { get; } = AgentType.Welcome;
16+
17+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
18+
[JsonPropertyName("request_id")]
19+
public string? RequestId { get; set; }
20+
21+
/// <summary>
22+
/// Override ToString method to serialize the object
23+
/// </summary>
24+
public override string ToString()
25+
{
26+
return Regex.Unescape(JsonSerializer.Serialize(this, JsonSerializeOptions.DefaultOptions));
27+
}
28+
}

examples/agent/websocket/no_mic/Program.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static async Task Main(string[] args)
4040
settingsConfiguration.Audio.Output.Container = "wav";
4141
settingsConfiguration.Audio.Input.SampleRate = 24000;
4242
settingsConfiguration.Agent.Greeting = "Hello, how can I help you today?";
43+
settingsConfiguration.Agent.Listen.Provider.Type = "deepgram";
4344
settingsConfiguration.Agent.Listen.Provider.Model = "nova-3";
4445
settingsConfiguration.Agent.Listen.Provider.Keyterms = new List<string> { "Deepgram" };
4546
settingsConfiguration.Agent.Speak.Provider.Type = "deepgram";
@@ -201,16 +202,6 @@ static async Task Main(string[] args)
201202
return;
202203
}
203204

204-
subscribeResult = await agentClient.Subscribe(new EventHandler<FunctionCallingResponse>((sender, e) =>
205-
{
206-
Console.WriteLine($"----> {e} received");
207-
}));
208-
if (!subscribeResult)
209-
{
210-
Console.WriteLine("Failed to subscribe to FunctionCallingResponse event");
211-
return;
212-
}
213-
214205
subscribeResult = await agentClient.Subscribe(new EventHandler<FunctionCallRequestResponse>((sender, e) =>
215206
{
216207
Console.WriteLine($"----> {e} received");

examples/agent/websocket/simple/Program.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ await agentClient.Subscribe(new EventHandler<ConversationTextResponse>((sender,
165165
{
166166
Console.WriteLine($"----> {e} received");
167167
}));
168-
await agentClient.Subscribe(new EventHandler<FunctionCallingResponse>((sender, e) =>
169-
{
170-
Console.WriteLine($"----> {e} received");
171-
}));
172168
await agentClient.Subscribe(new EventHandler<FunctionCallRequestResponse>((sender, e) =>
173169
{
174170
Console.WriteLine($"----> {e} received");
@@ -218,6 +214,7 @@ await agentClient.Subscribe(new EventHandler<ErrorResponse>((sender, e) =>
218214
settingsConfiguration.Audio.Output.Container = "wav";
219215
settingsConfiguration.Audio.Input.SampleRate = 44100;
220216
settingsConfiguration.Agent.Greeting = "Hello, how can I help you today?";
217+
settingsConfiguration.Agent.Listen.Provider.Type = "deepgram";
221218
settingsConfiguration.Agent.Listen.Provider.Model = "nova-3";
222219
settingsConfiguration.Agent.Listen.Provider.Keyterms = new List<string> { "Deepgram" };
223220
settingsConfiguration.Agent.Speak.Provider.Type = "deepgram";

output_0.wav

160 KB
Binary file not shown.

0 commit comments

Comments
 (0)