Skip to content

Commit 8956383

Browse files
authored
feat: Add more Bot Info (coze-dev#70)
1 parent 4415686 commit 8956383

13 files changed

Lines changed: 501 additions & 5 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* 知识库信息类。
3+
*/
4+
package com.coze.openapi.client.bots.model;
5+
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
import lombok.AllArgsConstructor;
9+
import lombok.Builder;
10+
import lombok.Data;
11+
import lombok.NoArgsConstructor;
12+
13+
@Data
14+
@Builder
15+
@NoArgsConstructor
16+
@AllArgsConstructor
17+
public class BotKnowledgeInfo {
18+
/**
19+
* 知识ID。
20+
*
21+
* <p>示例:738694398580390*****
22+
*/
23+
@JsonProperty("id")
24+
private String id;
25+
26+
/**
27+
* 知识名称。
28+
*
29+
* <p>示例:text
30+
*/
31+
@JsonProperty("name")
32+
private String name;
33+
}

api/src/main/java/com/coze/openapi/client/bots/model/Bot.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,13 @@ public class Bot {
4949

5050
@JsonProperty("model_info")
5151
private BotModelInfo modelInfo;
52+
53+
@JsonProperty("knowledge")
54+
private BotCommonKnowledge knowledge;
55+
56+
@JsonProperty("shortcut_commands")
57+
private List<BotShortcutCommandInfo> shortcutCommands;
58+
59+
@JsonProperty("workflow_info_list")
60+
private List<BotWorkflowInfo> workflowInfoList;
5261
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.coze.openapi.client.bots.model;
2+
3+
import java.util.List;
4+
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
7+
import lombok.AllArgsConstructor;
8+
import lombok.Builder;
9+
import lombok.Data;
10+
import lombok.NoArgsConstructor;
11+
12+
@Data
13+
@Builder
14+
@NoArgsConstructor
15+
@AllArgsConstructor
16+
public class BotCommonKnowledge {
17+
@JsonProperty("knowledge_infos")
18+
private List<BotKnowledgeInfo> knowledgeInfos;
19+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.coze.openapi.client.bots.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import lombok.AllArgsConstructor;
6+
import lombok.Builder;
7+
import lombok.Data;
8+
import lombok.NoArgsConstructor;
9+
10+
@Data
11+
@Builder
12+
@NoArgsConstructor
13+
@AllArgsConstructor
14+
public class BotKnowledgeInfo {
15+
/**
16+
* 知识ID。
17+
*
18+
* <p>示例:738694398580390*****
19+
*/
20+
@JsonProperty("id")
21+
private String id;
22+
23+
/**
24+
* 知识名称。
25+
*
26+
* <p>示例:text
27+
*/
28+
@JsonProperty("name")
29+
private String name;
30+
}

api/src/main/java/com/coze/openapi/client/bots/model/BotModelInfo.java

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,87 @@
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
44

5-
import lombok.AllArgsConstructor;
6-
import lombok.Builder;
7-
import lombok.Data;
8-
import lombok.NoArgsConstructor;
5+
import lombok.*;
96

107
@Data
118
@Builder
129
@NoArgsConstructor
1310
@AllArgsConstructor
1411
public class BotModelInfo {
12+
13+
/**
14+
* Top K。
15+
*
16+
* <p>示例:1
17+
*/
18+
@JsonProperty("top_k")
19+
private Integer topK;
20+
21+
/**
22+
* Top P,即累计概率。
23+
*
24+
* <p>示例:1.0
25+
*/
26+
@JsonProperty("top_p")
27+
private Double topP;
28+
29+
/**
30+
* 智能体绑定的模型 ID。
31+
*
32+
* <p>示例:1706077826
33+
*/
1534
@JsonProperty("model_id")
1635
private String modelID;
1736

37+
/**
38+
* 最大回复长度。
39+
*
40+
* <p>示例:4096
41+
*/
42+
@JsonProperty("max_tokens")
43+
private Integer maxTokens;
44+
45+
/**
46+
* 模型名称
47+
*
48+
* <p>示例:豆包·Function call模型
49+
*/
1850
@JsonProperty("model_name")
1951
private String modelName;
52+
53+
/**
54+
* 生成随机性。
55+
*
56+
* <p>示例:1.0
57+
*/
58+
@JsonProperty("temperature")
59+
private Double temperature;
60+
61+
/**
62+
* 携带上下文轮数。
63+
*
64+
* <p>示例:30
65+
*/
66+
@JsonProperty("context_round")
67+
private Integer contextRound;
68+
69+
/** 输出格式。 */
70+
@JsonProperty("response_format")
71+
private BotResponseFormat responseFormat;
72+
73+
/**
74+
* 重复主题惩罚。
75+
*
76+
* <p>示例:0.0
77+
*/
78+
@JsonProperty("presence_penalty")
79+
private Double presencePenalty;
80+
81+
/**
82+
* 重复语句惩罚。
83+
*
84+
* <p>示例:0.0
85+
*/
86+
@JsonProperty("frequency_penalty")
87+
private Double frequencyPenalty;
2088
}

api/src/main/java/com/coze/openapi/client/bots/model/BotModelInfoConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class BotModelInfoConfig {
7070
* 示例:text
7171
*/
7272
@JsonProperty("response_format")
73-
private String responseFormat;
73+
private BotResponseFormat responseFormat;
7474

7575
/**
7676
* 重复主题惩罚。
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.coze.openapi.client.bots.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonValue;
5+
6+
import lombok.Getter;
7+
8+
@Getter
9+
public class BotResponseFormat {
10+
public static final BotResponseFormat TEXT = new BotResponseFormat("text");
11+
12+
public static final BotResponseFormat MARKDOWN = new BotResponseFormat("markdown");
13+
14+
public static final BotResponseFormat JSON = new BotResponseFormat("json");
15+
16+
@JsonValue private final String value;
17+
18+
private BotResponseFormat(String value) {
19+
this.value = value;
20+
}
21+
22+
@JsonCreator
23+
public static BotResponseFormat fromValue(String value) {
24+
BotResponseFormat[] formats = {TEXT, MARKDOWN, JSON};
25+
for (BotResponseFormat type : formats) {
26+
if (type.value.equals(value)) {
27+
return type;
28+
}
29+
}
30+
return new BotResponseFormat(value);
31+
}
32+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.coze.openapi.client.bots.model;
2+
3+
import java.util.List;
4+
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
7+
import lombok.AllArgsConstructor;
8+
import lombok.Builder;
9+
import lombok.Data;
10+
import lombok.NoArgsConstructor;
11+
12+
@Data
13+
@Builder
14+
@NoArgsConstructor
15+
@AllArgsConstructor
16+
public class BotShortcutCommandComponent {
17+
/**
18+
* 组件的名称。
19+
*
20+
* <p>示例:query
21+
*/
22+
@JsonProperty("name")
23+
private String name;
24+
25+
/** 组件的类型 */
26+
@JsonProperty("type")
27+
private BotShortcutCommandComponentType type;
28+
29+
/**
30+
* 组件是否隐藏。
31+
*
32+
* <p>示例:false
33+
*/
34+
@JsonProperty("is_hide")
35+
private Boolean isHide;
36+
37+
/**
38+
* 组件的选项列表或支持的文件类型。
39+
*
40+
* <p>当 {@code type} 为 {@code select} 时,{@code options} 为组件的选项列表。
41+
*
42+
* <p>当 {@code type} 为 {@code file} 时,{@code options} 为组件支持的文件类型,取值为:
43+
*
44+
* <ul>
45+
* <li>{@code image}: 图片;
46+
* <li>{@code doc}: 文档;
47+
* <li>{@code table}: 表格;
48+
* <li>{@code audio}: 音频;
49+
* <li>{@code video}: 视频;
50+
* <li>{@code zip}: 压缩包;
51+
* <li>{@code code}: 代码;
52+
* <li>{@code txt}: TXT;
53+
* <li>{@code ppt}: PPT。
54+
* </ul>
55+
*/
56+
@JsonProperty("options")
57+
private List<String> options;
58+
59+
/**
60+
* 组件的描述。
61+
*
62+
* <p>示例:新闻搜索关键词
63+
*/
64+
@JsonProperty("description")
65+
private String description;
66+
67+
/**
68+
* 组件的默认值。
69+
*
70+
* <p>示例:科技新闻
71+
*/
72+
@JsonProperty("default_value")
73+
private String defaultValue;
74+
75+
/**
76+
* 组件对应的工具的参数名称。
77+
*
78+
* <p>示例:query
79+
*/
80+
@JsonProperty("tool_parameter")
81+
private String toolParameter;
82+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.coze.openapi.client.bots.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonValue;
5+
6+
import lombok.Getter;
7+
8+
@Getter
9+
public class BotShortcutCommandComponentType {
10+
/** 文本类型 */
11+
public static final BotShortcutCommandComponentType TEXT =
12+
new BotShortcutCommandComponentType("text");
13+
/** 选择框类型 */
14+
public static final BotShortcutCommandComponentType SELECT =
15+
new BotShortcutCommandComponentType("select");
16+
/** 上传文件类型 */
17+
public static final BotShortcutCommandComponentType FILE =
18+
new BotShortcutCommandComponentType("file");
19+
20+
@JsonValue private final String value;
21+
22+
private BotShortcutCommandComponentType(String value) {
23+
this.value = value;
24+
}
25+
26+
@JsonCreator
27+
public static BotShortcutCommandComponentType fromValue(String value) {
28+
BotShortcutCommandComponentType[] types = {TEXT, SELECT, FILE};
29+
for (BotShortcutCommandComponentType type : types) {
30+
if (type.value.equals(value)) {
31+
return type;
32+
}
33+
}
34+
return new BotShortcutCommandComponentType(value);
35+
}
36+
37+
@Override
38+
public String toString() {
39+
return value;
40+
}
41+
}

0 commit comments

Comments
 (0)