Skip to content

Commit

Permalink
fix: dialogflow-cx speech parameter (#8345)
Browse files Browse the repository at this point in the history
* fix: dialogflow-cx speech parameter

* update code
  • Loading branch information
kweinmeister authored Jun 26, 2023
1 parent 41e33cf commit 75c6188
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dialogflow-cx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<groupId>com.google.cloud</groupId>
<scope>import</scope>
<type>pom</type>
<version>26.12.0</version>
<version>26.17.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -72,7 +72,7 @@
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
import java.io.FileInputStream;
import java.io.IOException;

public class DetectIntentStream {
public abstract class DetectIntentStream {

// DialogFlow API Detect Intent sample with audio files processes as an audio stream.
public static void detectIntentStream(
String projectId, String locationId, String agentId, String sessionId, String audioFilePath)
throws ApiException, IOException {
SessionsSettings.Builder sessionsSettingsBuilder = SessionsSettings.newBuilder();
if (locationId.equals("global")) {
if ("global".equals(locationId)) {
sessionsSettingsBuilder.setEndpoint("dialogflow.googleapis.com:443");
} else {
sessionsSettingsBuilder.setEndpoint(locationId + "-dialogflow.googleapis.com:443");
Expand Down Expand Up @@ -90,7 +90,7 @@ public static void detectIntentStream(
VoiceSelectionParams voiceSelection =
// Voices that are available https://cloud.google.com/text-to-speech/docs/voices
VoiceSelectionParams.newBuilder()
.setName("en-GB-Standard-A")
.setName("en-US-Standard-F")
.setSsmlGender(SsmlVoiceGender.SSML_VOICE_GENDER_FEMALE)
.build();

Expand Down Expand Up @@ -143,7 +143,8 @@ public static void detectIntentStream(
System.out.format("Query Text: '%s'\n", queryResult.getTranscript());
System.out.format(
"Detected Intent: %s (confidence: %f)\n",
queryResult.getIntent().getDisplayName(), queryResult.getIntentDetectionConfidence());
queryResult.getMatch().getIntent().getDisplayName(),
queryResult.getMatch().getConfidence());
}
}
}
Expand Down

0 comments on commit 75c6188

Please sign in to comment.