@@ -76,6 +76,7 @@ public class YourService(IDashScopeClient client)
76
76
- Image Generation - ` CreateWanxImageGenerationTaskAsync() ` and ` GetWanxImageGenerationTaskAsync() `
77
77
- Background Image Generation - ` CreateWanxBackgroundGenerationTaskAsync() ` and ` GetWanxBackgroundGenerationTaskAsync() `
78
78
- File API that used by Qwen-Long - ` dashScopeClient.UploadFileAsync() ` and ` dashScopeClient.DeleteFileAsync `
79
+ - Application call - ` GetApplicationResponseAsync() ` and ` GetApplicationResponseStreamAsync() `
79
80
80
81
# Examples
81
82
@@ -208,3 +209,71 @@ Delete file if needed
208
209
``` csharp
209
210
var deletionResult = await dashScopeClient .DeleteFileAsync (uploadedFile .Id );
210
211
```
212
+
213
+ ## Application call
214
+
215
+ Use ` GetApplicationResponseAsync ` to call an application.
216
+
217
+ Use ` GetApplicationResponseStreamAsync ` for streaming output.
218
+
219
+ ``` csharp
220
+ var request =
221
+ new ApplicationRequest ()
222
+ {
223
+ Input = new ApplicationInput () { Prompt = " Summarize this file." },
224
+ Parameters = new ApplicationParameters ()
225
+ {
226
+ TopK = 100 ,
227
+ TopP = 0 . 8 f ,
228
+ Seed = 1234 ,
229
+ Temperature = 0 . 85 f ,
230
+ RagOptions = new ApplicationRagOptions ()
231
+ {
232
+ PipelineIds = [" thie5bysoj" ],
233
+ FileIds = [" file_d129d632800c45aa9e7421b30561f447_10207234" ]
234
+ }
235
+ }
236
+ };
237
+ var response = await client .GetApplicationResponseAsync (" your-application-id" , request );
238
+ Console .WriteLine (response .Output .Text );
239
+ ```
240
+
241
+ ` ApplicationRequest ` use an ` Dictionary<string, object?> ` as ` BizParams ` by default.
242
+
243
+ ``` csharp
244
+ var request =
245
+ new ApplicationRequest ()
246
+ {
247
+ Input = new ApplicationInput ()
248
+ {
249
+ Prompt = " Summarize this file." ,
250
+ BizParams = new Dictionary <string , object ?>()
251
+ {
252
+ { " customKey1" , " custom-value" }
253
+ }
254
+ }
255
+ };
256
+ var response = await client .GetApplicationResponseAsync (" your-application-id" , request );
257
+ Console .WriteLine (response .Output .Text );
258
+ ```
259
+
260
+ You can use the generic version ` ApplicationRequest<TBizParams> ` for strong-typed ` BizParams ` . But keep in mind that client use ` snake_case ` by default when doing json serialization, you may need to use ` [JsonPropertyName("camelCase")] ` for other type of naming policy.
261
+
262
+ ``` csharp
263
+ public record TestApplicationBizParam (
264
+ [property : JsonPropertyName (" sourceCode" )]
265
+ string SourceCode );
266
+
267
+ var request =
268
+ new ApplicationRequest <TestApplicationBizParam >()
269
+ {
270
+ Input = new ApplicationInput <TestApplicationBizParam >()
271
+ {
272
+ Prompt = " Summarize this file." ,
273
+ BizParams = new TestApplicationBizParam (" test" )
274
+ }
275
+ };
276
+ var response = await client .GetApplicationResponseAsync (" your-application-id" , request );
277
+ Console .WriteLine (response .Output .Text );
278
+ ```
279
+
0 commit comments