Skip to content

Commit d00975c

Browse files
authored
(model/audio): add tokens in usage output message (#276)
1 parent 84d718b commit d00975c

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
// Copyright (c) Alibaba, Inc. and its affiliates.
22
package com.alibaba.dashscope.audio.asr.recognition;
33

4+
import com.alibaba.dashscope.utils.ApiKeywords;
5+
import com.google.gson.annotations.SerializedName;
46
import lombok.Data;
57
import lombok.experimental.SuperBuilder;
68

79
@Data
810
@SuperBuilder
911
public final class RecognitionUsage {
1012
private Integer duration;
13+
14+
@SerializedName(ApiKeywords.INPUT_TOKENS)
15+
private Integer inputTokens;
16+
17+
@SerializedName(ApiKeywords.OUTPUT_TOKENS)
18+
private Integer outputTokens;
19+
20+
@SerializedName(ApiKeywords.TOTAL_TOKENS)
21+
private Integer totalTokens;
1122
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
// Copyright (c) Alibaba, Inc. and its affiliates.
22
package com.alibaba.dashscope.audio.tts;
33

4+
import com.alibaba.dashscope.utils.ApiKeywords;
5+
import com.google.gson.annotations.SerializedName;
46
import lombok.Data;
57
import lombok.experimental.SuperBuilder;
68

79
@Data
810
@SuperBuilder
911
public final class SpeechSynthesisUsage {
1012
private Integer characters;
13+
14+
@SerializedName(ApiKeywords.INPUT_TOKENS)
15+
private Integer inputTokens;
16+
17+
@SerializedName(ApiKeywords.OUTPUT_TOKENS)
18+
private Integer outputTokens;
19+
20+
@SerializedName(ApiKeywords.TOTAL_TOKENS)
21+
private Integer totalTokens;
1122
}

‎src/main/java/com/alibaba/dashscope/utils/ApiKeywords.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public class ApiKeywords {
9393

9494
public static final String INPUT_TOKENS = "input_tokens";
9595

96+
public static final String TOTAL_TOKENS = "total_tokens";
97+
9698
public static final String ERROR = "error";
9799

98100
public static final String EVENT = "event";

0 commit comments

Comments
 (0)