Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added StreamingAnalyzeContent API
feat: Added obfuscated_external_user_id to Participant feat: Can directly set Cloud Speech model on the SpeechToTextConfig PiperOrigin-RevId: 483696090 Source-Link: googleapis/googleapis@3772bf3 Source-Link: googleapis/googleapis-gen@e358d26 Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuRGlhbG9nZmxvdy5WMi8uT3dsQm90LnlhbWwiLCJoIjoiZTM1OGQyNjliMWYwZWI5OTY0MTg5ZDE4NzY4ODIzYmM5ZThhYjQxYyJ9
- Loading branch information
1 parent
8aa3a16
commit bdfcd9e
Showing
10 changed files
with
2,634 additions
and
256 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
...ud.Dialogflow.V2.GeneratedSnippets/ParticipantsClient.StreamingAnalyzeContentSnippet.g.cs
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,85 @@ | ||
// Copyright 2022 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Generated code. DO NOT EDIT! | ||
|
||
namespace Google.Cloud.Dialogflow.V2.Snippets | ||
{ | ||
// [START dialogflow_v2_generated_Participants_StreamingAnalyzeContent_sync] | ||
using Google.Api.Gax.Grpc; | ||
using Google.Cloud.Dialogflow.V2; | ||
using Google.Protobuf; | ||
using Google.Protobuf.WellKnownTypes; | ||
using System.Threading.Tasks; | ||
|
||
public sealed partial class GeneratedParticipantsClientSnippets | ||
{ | ||
/// <summary>Snippet for StreamingAnalyzeContent</summary> | ||
/// <remarks> | ||
/// This snippet has been automatically generated for illustrative purposes only. | ||
/// It may require modifications to work in your environment. | ||
/// </remarks> | ||
public async Task StreamingAnalyzeContent() | ||
{ | ||
// Create client | ||
ParticipantsClient participantsClient = ParticipantsClient.Create(); | ||
// Initialize streaming call, retrieving the stream object | ||
ParticipantsClient.StreamingAnalyzeContentStream response = participantsClient.StreamingAnalyzeContent(); | ||
|
||
// Sending requests and retrieving responses can be arbitrarily interleaved | ||
// Exact sequence will depend on client/server behavior | ||
|
||
// Create task to do something with responses from server | ||
Task responseHandlerTask = Task.Run(async () => | ||
{ | ||
// Note that C# 8 code can use await foreach | ||
AsyncResponseStream<StreamingAnalyzeContentResponse> responseStream = response.GetResponseStream(); | ||
while (await responseStream.MoveNextAsync()) | ||
{ | ||
StreamingAnalyzeContentResponse responseItem = responseStream.Current; | ||
// Do something with streamed response | ||
} | ||
// The response stream has completed | ||
}); | ||
|
||
// Send requests to the server | ||
bool done = false; | ||
while (!done) | ||
{ | ||
// Initialize a request | ||
StreamingAnalyzeContentRequest request = new StreamingAnalyzeContentRequest | ||
{ | ||
ParticipantAsParticipantName = ParticipantName.FromProjectConversationParticipant("[PROJECT]", "[CONVERSATION]", "[PARTICIPANT]"), | ||
AudioConfig = new InputAudioConfig(), | ||
ReplyAudioConfig = new OutputAudioConfig(), | ||
InputAudio = ByteString.Empty, | ||
QueryParams = new QueryParameters(), | ||
AssistQueryParams = new AssistQueryParameters(), | ||
EnablePartialAutomatedAgentReply = false, | ||
CxParameters = new Struct(), | ||
}; | ||
// Stream a request to the server | ||
await response.WriteAsync(request); | ||
// Set "done" to true when sending requests is complete | ||
} | ||
|
||
// Complete writing requests to the stream | ||
await response.WriteCompleteAsync(); | ||
// Await the response handler | ||
// This will complete once all server responses have been processed | ||
await responseHandlerTask; | ||
} | ||
} | ||
// [END dialogflow_v2_generated_Participants_StreamingAnalyzeContent_sync] | ||
} |
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
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
Oops, something went wrong.