Skip to content

Commit b4fe7d2

Browse files
committed
Builds
1 parent 3c2cdf0 commit b4fe7d2

16 files changed

+142
-110
lines changed

sdk/ai/Azure.AI.VoiceLive/src/Generated/AIVoiceLiveModelFactory.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/Azure.AI.VoiceLive/src/Generated/VoiceLiveServerEventResponseOutputItemAdded.Serialization.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/Azure.AI.VoiceLive/src/Generated/VoiceLiveServerEventResponseOutputItemAdded.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/Azure.AI.VoiceLive/src/Updates/ErrorUpdate.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal ErrorUpdate(
4545
/// <summary>
4646
/// Gets the error details.
4747
/// </summary>
48-
public Error Error => _errorEvent?.Error;
48+
public Error Error => new Error(_errorEvent?.Error.Code, _errorEvent?.Error.Message, _errorEvent?.Error.Param, _errorEvent?.Type.ToString(), _errorEvent?.EventId, null);
4949

5050
/// <summary>
5151
/// Gets the error type.
@@ -82,23 +82,23 @@ public override string ToString()
8282
return $"ErrorUpdate: Unknown error";
8383

8484
var parts = new List<string>();
85-
85+
8686
if (!string.IsNullOrEmpty(ErrorType))
8787
parts.Add($"Type: {ErrorType}");
88-
88+
8989
if (!string.IsNullOrEmpty(ErrorCode))
9090
parts.Add($"Code: {ErrorCode}");
91-
91+
9292
if (!string.IsNullOrEmpty(ErrorMessage))
9393
parts.Add($"Message: {ErrorMessage}");
94-
94+
9595
if (!string.IsNullOrEmpty(ErrorParam))
9696
parts.Add($"Param: {ErrorParam}");
97-
97+
9898
if (!string.IsNullOrEmpty(ErrorEventId))
9999
parts.Add($"EventId: {ErrorEventId}");
100100

101101
return $"ErrorUpdate: {string.Join(", ", parts)}";
102102
}
103103
}
104-
}
104+
}

sdk/ai/Azure.AI.VoiceLive/src/Updates/OutputDeltaUpdate.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public BinaryData AudioDelta
154154
}
155155
}
156156

157+
/*
157158
/// <summary>
158159
/// Gets the blendshape candidates, if this is an animation blendshape update.
159160
/// </summary>
@@ -198,6 +199,7 @@ public int? TimestampDelta
198199
};
199200
}
200201
}
202+
*/
201203

202204
/// <summary>
203205
/// Gets the timestamp type, if this is an audio timestamp update.
@@ -244,4 +246,4 @@ public ResponseAudioTimestampDeltaEventTimestampType? TimestampType
244246
/// </summary>
245247
public bool IsTranscriptDelta => Kind == VoiceLiveUpdateKind.ResponseAudioTranscriptDelta;
246248
}
247-
}
249+
}

sdk/ai/Azure.AI.VoiceLive/src/Updates/OutputStreamingUpdate.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public int? ContentIndex
131131
VoiceLiveServerEventResponseTextDone textDone => textDone.ContentIndex,
132132
VoiceLiveServerEventResponseAudioDone audioDone => audioDone.ContentIndex,
133133
VoiceLiveServerEventResponseAudioTranscriptDone transcriptDone => transcriptDone.ContentIndex,
134-
ResponseAnimationBlendshapeDoneEvent blendshapeDone => blendshapeDone.ContentIndex,
134+
// ResponseAnimationBlendshapeDoneEvent blendshapeDone => blendshapeDone.ContentIndex,
135135
ResponseAnimationVisemeDoneEvent visemeDone => visemeDone.ContentIndex,
136136
ResponseAudioTimestampDoneEvent timestampDone => timestampDone.ContentIndex,
137137
_ => null
@@ -266,18 +266,14 @@ public string Text
266266
/// <summary>
267267
/// Gets a value indicating whether this represents a completion of any kind.
268268
/// </summary>
269-
public bool IsCompleted => Kind switch
270-
{
271-
VoiceLiveUpdateKind.ResponseCompleted => true,
272-
VoiceLiveUpdateKind.ResponseOutputItemDone => true,
273-
VoiceLiveUpdateKind.ResponseContentPartDone => true,
274-
VoiceLiveUpdateKind.ResponseTextDone => true,
275-
VoiceLiveUpdateKind.ResponseAudioDone => true,
276-
VoiceLiveUpdateKind.ResponseAudioTranscriptDone => true,
277-
VoiceLiveUpdateKind.ResponseAnimationBlendshapesDone => true,
278-
VoiceLiveUpdateKind.ResponseAnimationVisemeDone => true,
279-
VoiceLiveUpdateKind.ResponseAudioTimestampDone => true,
280-
_ => false
281-
};
269+
public bool IsCompleted => (Kind == VoiceLiveUpdateKind.ResponseCompleted ||
270+
Kind == VoiceLiveUpdateKind.ResponseOutputItemDone ||
271+
Kind == VoiceLiveUpdateKind.ResponseContentPartDone ||
272+
Kind == VoiceLiveUpdateKind.ResponseTextDone ||
273+
Kind == VoiceLiveUpdateKind.ResponseAudioDone ||
274+
Kind == VoiceLiveUpdateKind.ResponseAudioTranscriptDone ||
275+
Kind == VoiceLiveUpdateKind.ResponseAnimationBlendshapesDone ||
276+
Kind == VoiceLiveUpdateKind.ResponseAnimationVisemeDone ||
277+
Kind == VoiceLiveUpdateKind.ResponseAudioTimestampDone);
282278
}
283-
}
279+
}

sdk/ai/Azure.AI.VoiceLive/src/Updates/SessionStartedUpdate.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ internal SessionStartedUpdate(
5252
/// </summary>
5353
public string SessionId => Session?.Id;
5454

55+
/*
5556
/// <summary>
5657
/// Gets the session object type.
5758
/// </summary>
5859
public string SessionObject => Session?.Object;
60+
*/
5961
}
60-
}
62+
}

sdk/ai/Azure.AI.VoiceLive/src/Updates/VoiceLiveUpdate.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ internal VoiceLiveUpdate(VoiceLiveUpdateKind kind, string eventId, IDictionary<s
5252
/// Gets the raw content of this update as binary data.
5353
/// </summary>
5454
/// <returns>The binary data representation of this update.</returns>
55-
public virtual BinaryData GetRawContent() => ModelReaderWriter.Write(this);
55+
public virtual BinaryData GetRawContent() => ModelReaderWriter.Write(this, null, null);
5656

5757
/// <summary>
5858
/// Creates a VoiceLiveUpdate from a VoiceLiveServerEvent.
@@ -76,7 +76,7 @@ internal static VoiceLiveUpdate FromServerEvent(VoiceLiveServerEvent serverEvent
7676
internal static VoiceLiveUpdate FromBinaryData(BinaryData data, ModelReaderWriterOptions options = null)
7777
{
7878
options ??= ModelSerializationExtensions.WireOptions;
79-
79+
8080
using JsonDocument document = JsonDocument.Parse(data);
8181
return DeserializeVoiceLiveUpdate(document.RootElement, options);
8282
}
@@ -187,7 +187,7 @@ protected virtual VoiceLiveUpdate PersistableModelCreateCore(BinaryData data, Mo
187187
/// <returns>The binary data representation.</returns>
188188
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options)
189189
{
190-
return ModelReaderWriter.Write(this, options);
190+
return ModelReaderWriter.Write(this, options, null);
191191
}
192192

193193
/// <summary>
@@ -234,4 +234,4 @@ internal static VoiceLiveUpdate DeserializeVoiceLiveUpdate(JsonElement element,
234234
return VoiceLiveUpdateFactory.CreateUpdate(element, kind, eventId, additionalPropertiesDictionary, options);
235235
}
236236
}
237-
}
237+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
9+
namespace Azure.AI.VoiceLive
10+
{
11+
/// <summary> The VoiceLiveRequestSession. </summary>
12+
public partial class VoiceLiveRequestSession
13+
{
14+
/// <summary>
15+
/// Serialized additional properties for the request session
16+
/// </summary>
17+
internal IDictionary<string, BinaryData> AdditionalProperties => this._serializedAdditionalRawData;
18+
}
19+
}

sdk/ai/Azure.AI.VoiceLive/src/VoiceLiveSession.Commands.cs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
using System.Threading;
88
using System.Threading.Tasks;
99
using Azure.Core;
10+
using Azure.Core.Pipeline;
1011

1112
namespace Azure.AI.VoiceLive
1213
{
14+
#pragma warning disable AZC0107
1315
public partial class VoiceLiveSession
1416
{
1517
#region Audio Data Transmission
@@ -50,7 +52,7 @@ public virtual async Task SendInputAudioAsync(byte[] audio, CancellationToken ca
5052
/// <exception cref="InvalidOperationException">Thrown when another audio stream is already being sent.</exception>
5153
public virtual void SendInputAudio(byte[] audio, CancellationToken cancellationToken = default)
5254
{
53-
SendInputAudioAsync(audio, cancellationToken).GetAwaiter().GetResult();
55+
SendInputAudioAsync(audio, cancellationToken).EnsureCompleted();
5456
}
5557

5658
/// <summary>
@@ -89,7 +91,7 @@ public virtual async Task SendInputAudioAsync(BinaryData audio, CancellationToke
8991
/// <exception cref="InvalidOperationException">Thrown when another audio stream is already being sent.</exception>
9092
public virtual void SendInputAudio(BinaryData audio, CancellationToken cancellationToken = default)
9193
{
92-
SendInputAudioAsync(audio, cancellationToken).GetAwaiter().GetResult();
94+
SendInputAudioAsync(audio, cancellationToken).EnsureCompleted();
9395
}
9496

9597
/// <summary>
@@ -111,7 +113,7 @@ public virtual async Task ClearInputAudioAsync(CancellationToken cancellationTok
111113
/// <param name="cancellationToken">An optional cancellation token.</param>
112114
public virtual void ClearInputAudio(CancellationToken cancellationToken = default)
113115
{
114-
ClearInputAudioAsync(cancellationToken).GetAwaiter().GetResult();
116+
ClearInputAudioAsync(cancellationToken).EnsureCompleted();
115117
}
116118

117119
/// <summary>
@@ -133,7 +135,7 @@ public virtual async Task CommitInputAudioAsync(CancellationToken cancellationTo
133135
/// <param name="cancellationToken">An optional cancellation token.</param>
134136
public virtual void CommitInputAudio(CancellationToken cancellationToken = default)
135137
{
136-
CommitInputAudioAsync(cancellationToken).GetAwaiter().GetResult();
138+
CommitInputAudioAsync(cancellationToken).EnsureCompleted();
137139
}
138140

139141
#endregion
@@ -166,7 +168,7 @@ public virtual async Task ConfigureSessionAsync(VoiceLiveSessionOptions sessionO
166168
/// <exception cref="ArgumentNullException">Thrown when <paramref name="sessionOptions"/> is null.</exception>
167169
public virtual void ConfigureSession(VoiceLiveSessionOptions sessionOptions, CancellationToken cancellationToken = default)
168170
{
169-
ConfigureSessionAsync(sessionOptions, cancellationToken).GetAwaiter().GetResult();
171+
ConfigureSessionAsync(sessionOptions, cancellationToken).EnsureCompleted();
170172
}
171173

172174
/// <summary>
@@ -189,7 +191,7 @@ public virtual async Task ConfigureConversationSessionAsync(ConversationSessionO
189191
/// <exception cref="ArgumentNullException">Thrown when <paramref name="sessionOptions"/> is null.</exception>
190192
public virtual void ConfigureConversationSession(ConversationSessionOptions sessionOptions, CancellationToken cancellationToken = default)
191193
{
192-
ConfigureConversationSessionAsync(sessionOptions, cancellationToken).GetAwaiter().GetResult();
194+
ConfigureConversationSessionAsync(sessionOptions, cancellationToken).EnsureCompleted();
193195
}
194196

195197
/// <summary>
@@ -212,7 +214,7 @@ public virtual async Task ConfigureTranscriptionSessionAsync(TranscriptionSessio
212214
/// <exception cref="ArgumentNullException">Thrown when <paramref name="sessionOptions"/> is null.</exception>
213215
public virtual void ConfigureTranscriptionSession(TranscriptionSessionOptions sessionOptions, CancellationToken cancellationToken = default)
214216
{
215-
ConfigureTranscriptionSessionAsync(sessionOptions, cancellationToken).GetAwaiter().GetResult();
217+
ConfigureTranscriptionSessionAsync(sessionOptions, cancellationToken).EnsureCompleted();
216218
}
217219

218220
#endregion
@@ -278,7 +280,7 @@ public virtual async Task AddItemAsync(VoiceLiveConversationItem item, string pr
278280
/// <exception cref="ArgumentNullException">Thrown when <paramref name="item"/> is null.</exception>
279281
public virtual void AddItem(VoiceLiveConversationItem item, string previousItemId, CancellationToken cancellationToken = default)
280282
{
281-
AddItemAsync(item, previousItemId, cancellationToken).GetAwaiter().GetResult();
283+
AddItemAsync(item, previousItemId, cancellationToken).EnsureCompleted();
282284
}
283285

284286
/// <summary>
@@ -308,7 +310,7 @@ public virtual async Task RequestItemRetrievalAsync(string itemId, CancellationT
308310
/// <exception cref="ArgumentException">Thrown when <paramref name="itemId"/> is empty.</exception>
309311
public virtual void RequestItemRetrieval(string itemId, CancellationToken cancellationToken = default)
310312
{
311-
RequestItemRetrievalAsync(itemId, cancellationToken).GetAwaiter().GetResult();
313+
RequestItemRetrievalAsync(itemId, cancellationToken).EnsureCompleted();
312314
}
313315

314316
/// <summary>
@@ -338,7 +340,7 @@ public virtual async Task DeleteItemAsync(string itemId, CancellationToken cance
338340
/// <exception cref="ArgumentException">Thrown when <paramref name="itemId"/> is empty.</exception>
339341
public virtual void DeleteItem(string itemId, CancellationToken cancellationToken = default)
340342
{
341-
DeleteItemAsync(itemId, cancellationToken).GetAwaiter().GetResult();
343+
DeleteItemAsync(itemId, cancellationToken).EnsureCompleted();
342344
}
343345

344346
/// <summary>
@@ -377,9 +379,8 @@ public virtual async Task TruncateConversationAsync(string itemId, int contentIn
377379
/// <exception cref="ArgumentException">Thrown when <paramref name="itemId"/> is empty.</exception>
378380
public virtual void TruncateConversation(string itemId, int contentIndex, CancellationToken cancellationToken = default)
379381
{
380-
TruncateConversationAsync(itemId, contentIndex, cancellationToken).GetAwaiter().GetResult();
382+
TruncateConversationAsync(itemId, contentIndex, cancellationToken).EnsureCompleted();
381383
}
382-
383384
#endregion
384385

385386
#region Response Management
@@ -435,7 +436,7 @@ public virtual async Task StartResponseAsync(VoiceLiveResponseOptions responseOp
435436
/// <param name="cancellationToken">An optional cancellation token.</param>
436437
public virtual void StartResponse(VoiceLiveResponseOptions responseOptions, CancellationToken cancellationToken = default)
437438
{
438-
StartResponseAsync(responseOptions, cancellationToken).GetAwaiter().GetResult();
439+
StartResponseAsync(responseOptions, cancellationToken).EnsureCompleted();
439440
}
440441

441442
/// <summary>
@@ -468,7 +469,7 @@ public virtual async Task StartResponseAsync(string additionalInstructions, Canc
468469
/// <exception cref="ArgumentNullException">Thrown when <paramref name="additionalInstructions"/> is null.</exception>
469470
public virtual void StartResponse(string additionalInstructions, CancellationToken cancellationToken = default)
470471
{
471-
StartResponseAsync(additionalInstructions, cancellationToken).GetAwaiter().GetResult();
472+
StartResponseAsync(additionalInstructions, cancellationToken).EnsureCompleted();
472473
}
473474

474475
/// <summary>
@@ -491,9 +492,10 @@ public virtual async Task CancelResponseAsync(CancellationToken cancellationToke
491492
/// <param name="cancellationToken">An optional cancellation token.</param>
492493
public virtual void CancelResponse(CancellationToken cancellationToken = default)
493494
{
494-
CancelResponseAsync(cancellationToken).GetAwaiter().GetResult();
495+
CancelResponseAsync(cancellationToken).EnsureCompleted();
495496
}
496497

497498
#endregion
498499
}
499-
}
500+
#pragma warning restore AZC0107
501+
}

0 commit comments

Comments
 (0)