MCPcopy Create free account
hub / github.com/dashscope/dashscope-sdk-java / streamCall

Method streamCall

examples/legacy_2x/QwenASRUsage.java:16–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 private static final String modelName = "qwen3-asr-flash";
15
16 public static void streamCall() throws ApiException, NoApiKeyException, UploadFileException {
17 MultiModalConversation conv = new MultiModalConversation();
18 // must create mutable map.
19 MultiModalMessage userMessage =
20 MultiModalMessage.builder()
21 .role(Role.USER.getValue())
22 .content(
23 Arrays.asList(
24 new HashMap<String, Object>() {
25 {
26 put(
27 "audio",
28 "https://dashscope.oss-cn-beijing.aliyuncs.com/audios/welcome.mp3");
29 }
30 }))
31 .build();
32 MultiModalConversationParam param =
33 MultiModalConversationParam.builder()
34 .model(modelName)
35 .message(userMessage)
36 .parameter(
37 "asr_options",
38 new HashMap<String, Object>() {
39 {
40 put("enable_lid", true);
41 put("language", "zh");
42 }
43 })
44 .incrementalOutput(true)
45 .build();
46 Flowable<MultiModalConversationResult> result = conv.streamCall(param);
47 result.blockingForEach(
48 item -> {
49 if (item.getOutput() == null) {
50 return;
51 }
52 try {
53 System.out.println(
54 item.getOutput().getChoices().get(0).getMessage().getContent().get(0).get("text"));
55 } catch (Exception e) {
56 System.exit(0);
57 }
58 });
59 }
60
61 public static void main(String[] args) {
62 try {

Callers 1

mainMethod · 0.95

Calls 14

streamCallMethod · 0.95
contentMethod · 0.80
roleMethod · 0.80
messageMethod · 0.80
buildMethod · 0.65
getContentMethod · 0.65
builderMethod · 0.45
getValueMethod · 0.45
incrementalOutputMethod · 0.45
modelMethod · 0.45
getOutputMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected