Skip to content

Commit ccb7b52

Browse files
authored
[VertexAI] Remove option from LiveSession Receive (#1240)
1 parent 2a172f2 commit ccb7b52

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

vertexai/src/LiveSession.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,11 @@ public Task SendAudioAsync(float[] audioData, CancellationToken cancellationToke
171171

172172
/// <summary>
173173
/// Receives a stream of responses from the server. Having multiple of these ongoing will result in unexpected behavior.
174+
/// Closes upon receiving a TurnComplete from the server.
174175
/// </summary>
175-
/// <param name="closeOnTurnComplete">Should the stream stop when the server returns TurnComplete.</param>
176176
/// <param name="cancellationToken">A token to cancel the operation.</param>
177177
/// <returns>A stream of `LiveContentResponse`s from the backend.</returns>
178178
public async IAsyncEnumerable<LiveSessionResponse> ReceiveAsync(
179-
bool closeOnTurnComplete = true,
180179
[EnumeratorCancellation] CancellationToken cancellationToken = default) {
181180
if (_clientWebSocket.State != WebSocketState.Open) {
182181
throw new InvalidOperationException("WebSocket is not open. Cannot start receiving.");
@@ -206,8 +205,8 @@ public async IAsyncEnumerable<LiveSessionResponse> ReceiveAsync(
206205
if (response != null) {
207206
yield return response.Value;
208207

209-
if (closeOnTurnComplete &&
210-
response?.Message is LiveSessionContent serverContent &&
208+
// On receiving TurnComplete we close the ongoing connection.
209+
if (response?.Message is LiveSessionContent serverContent &&
211210
serverContent.TurnComplete) {
212211
break;
213212
}

0 commit comments

Comments
 (0)