@@ -318,10 +318,53 @@ public static void callWithThinking() throws NoApiKeyException, InputRequiredExc
318318 Application application = new Application ();
319319 Flowable <ApplicationResult > result = application .streamCall (param );
320320 result .blockingForEach (data -> System .out .printf ("result: %s%n" , data ));
321- // result.blockingForEach(data -> System.out.printf(data.getOutput().getText()));
322321 System .out .print ("\n " );
323322 }
324323
324+ /**
325+ * Call with file list sample
326+ *
327+ * @throws NoApiKeyException Can not find api key
328+ * @throws ApiException The request failed, possibly
329+ * due to a network or data error.
330+ * @throws InputRequiredException Missing inputs.
331+ */
332+ public static void callWithFileList ()
333+ throws ApiException , NoApiKeyException , InputRequiredException {
334+ ApplicationParam param = ApplicationParam .builder ()
335+ .appId (APP_ID )
336+ .prompt ("总结文件内容" )
337+ .files (Collections .singletonList (
338+ "https://dashscope.oss-cn-beijing.aliyuncs.com/audios/welcome.mp3" ))
339+ .build ();
340+
341+ Application application = new Application ();
342+ ApplicationResult result = application .call (param );
343+
344+ System .out .println (JsonUtils .toJson (result ));
345+ }
346+
347+ /**
348+ * Stream call with file list sample
349+ *
350+ * @throws NoApiKeyException Can not find api key
351+ * @throws InputRequiredException Missing inputs.
352+ */
353+ public static void streamCallWithFileList ()
354+ throws NoApiKeyException , InputRequiredException {
355+ ApplicationParam param = ApplicationParam .builder ()
356+ .appId (APP_ID )
357+ .prompt ("总结文件内容" )
358+ .files (Collections .singletonList (
359+ "https://dashscope.oss-cn-beijing.aliyuncs.com/audios/welcome.mp3" ))
360+ .incrementalOutput (true )
361+ .build ();
362+
363+ Application application = new Application ();
364+ Flowable <ApplicationResult > result = application .streamCall (param );
365+ result .blockingForEach (data -> System .out .println (JsonUtils .toJson (data )));
366+ }
367+
325368
326369 public static void main (String [] args ) {
327370 try {
@@ -335,7 +378,9 @@ public static void main(String[] args) {
335378// callWithAssistantServing();
336379// ragCallWithDocReference();
337380// callWithMoreParameters();
338- callWithThinking ();
381+ // callWithThinking();
382+ callWithFileList ();
383+ // streamCallWithFileList();
339384 } catch (ApiException | NoApiKeyException | InputRequiredException e ) {
340385 System .out .printf ("Exception: %s" , e .getMessage ());
341386 }
0 commit comments