Skip to content

Commit 75c6188

Browse files
authored
fix: dialogflow-cx speech parameter (GoogleCloudPlatform#8345)
* fix: dialogflow-cx speech parameter * update code
1 parent 41e33cf commit 75c6188

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

dialogflow-cx/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<groupId>com.google.cloud</groupId>
3333
<scope>import</scope>
3434
<type>pom</type>
35-
<version>26.12.0</version>
35+
<version>26.17.0</version>
3636
</dependency>
3737
</dependencies>
3838
</dependencyManagement>
@@ -72,7 +72,7 @@
7272
<dependency>
7373
<groupId>com.google.truth</groupId>
7474
<artifactId>truth</artifactId>
75-
<version>1.1.4</version>
75+
<version>1.1.5</version>
7676
<scope>test</scope>
7777
</dependency>
7878
</dependencies>

dialogflow-cx/src/main/java/dialogflow/cx/DetectIntentStream.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
import java.io.FileInputStream;
4040
import java.io.IOException;
4141

42-
public class DetectIntentStream {
42+
public abstract class DetectIntentStream {
4343

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

@@ -143,7 +143,8 @@ public static void detectIntentStream(
143143
System.out.format("Query Text: '%s'\n", queryResult.getTranscript());
144144
System.out.format(
145145
"Detected Intent: %s (confidence: %f)\n",
146-
queryResult.getIntent().getDisplayName(), queryResult.getIntentDetectionConfidence());
146+
queryResult.getMatch().getIntent().getDisplayName(),
147+
queryResult.getMatch().getConfidence());
147148
}
148149
}
149150
}

0 commit comments

Comments
 (0)