Skip to content

Commit 29a364d

Browse files
committed
Merge 'feat/knowlede_base' into 'master'
feat: knowledge base See merge request: !920
2 parents b8d84d4 + e1e26cd commit 29a364d

13 files changed

Lines changed: 668 additions & 0 deletions

File tree

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/model/responses/constant/ResponsesConstants.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class ResponsesConstants {
7878
public static final String TOOL_TYPE_WEB_SEARCH = "web_search";
7979
public static final String TOOL_TYPE_IMAGE_PROCESS = "image_process";
8080
public static final String TOOL_TYPE_MCP = "mcp";
81+
public static final String TOOL_TYPE_KNOWLEDGE_SEARCH = "knowledge_search";
8182
public static final String TOOL_TYPE_DOUBAO_APP = "doubao_app";
8283

8384
// UserLocationType.Enum
@@ -157,6 +158,12 @@ public class ResponsesConstants {
157158
public static final String EVENT_TYPE_RESPONSE_DOUBAO_APP_CALL_BLOCK_ADDED = "response.doubao_app_call_block.added";
158159
public static final String EVENT_TYPE_RESPONSE_DOUBAO_APP_CALL_BLOCK_DONE = "response.doubao_app_call_block.done";
159160

161+
// Knowledge search events
162+
public static final String EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_IN_PROGRESS = "response.knowledge_search_call.in_progress";
163+
public static final String EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_SEARCHING = "response.knowledge_search_call.searching";
164+
public static final String EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_COMPLETED = "response.knowledge_search_call.completed";
165+
public static final String EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_FAILED = "response.knowledge_search_call.failed";
166+
160167
// IncludeType.Enum
161168
public static final String INCLUDE_TYPE_IMAGE_URL = "message.input_image.image_url";
162169

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/model/responses/event/StreamEvent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.annotation.JsonTypeInfo;
77
import com.volcengine.ark.runtime.model.responses.constant.ResponsesConstants;
88
import com.volcengine.ark.runtime.model.responses.event.doubaoapp.*;
9+
import com.volcengine.ark.runtime.model.responses.event.knowledgesearch.*;
910
import com.volcengine.ark.runtime.model.responses.event.mcp.*;
1011
import com.volcengine.ark.runtime.model.responses.event.outputtext.AnnotationAddedEvent;
1112
import com.volcengine.ark.runtime.model.responses.event.contentpart.ContentPartAddedEvent;
@@ -85,6 +86,10 @@
8586
@JsonSubTypes.Type(value = DoubaoAppCallReasoningSearchInProgressEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_DOUBAO_APP_CALL_REASONING_SEARCH_IN_PROGRESS),
8687
@JsonSubTypes.Type(value = DoubaoAppCallReasoningSearchSearchingEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_DOUBAO_APP_CALL_REASONING_SEARCH_SEARCHING),
8788
@JsonSubTypes.Type(value = DoubaoAppCallReasoningSearchCompletedEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_DOUBAO_APP_CALL_REASONING_SEARCH_COMPLETED),
89+
@JsonSubTypes.Type(value = KnowledgeSearchCallInProgressEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_IN_PROGRESS),
90+
@JsonSubTypes.Type(value = KnowledgeSearchCallSearchingEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_SEARCHING),
91+
@JsonSubTypes.Type(value = KnowledgeSearchCallCompletedEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_COMPLETED),
92+
@JsonSubTypes.Type(value = KnowledgeSearchCallFailedEvent.class, name = ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_FAILED),
8893
})
8994
public abstract class StreamEvent {
9095

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.volcengine.ark.runtime.model.responses.event.knowledgesearch;
2+
3+
import com.volcengine.ark.runtime.model.responses.constant.ResponsesConstants;
4+
import com.volcengine.ark.runtime.model.responses.event.ItemEvent;
5+
6+
public class KnowledgeSearchCallCompletedEvent extends ItemEvent {
7+
8+
public KnowledgeSearchCallCompletedEvent() {
9+
super(ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_COMPLETED);
10+
}
11+
12+
@Override
13+
public String toString() {
14+
return "KnowledgeSearchCallCompletedEvent{" +
15+
"type='" + getType() + '\'' +
16+
", sequenceNumber=" + getSequenceNumber() +
17+
", itemId='" + getItemId() + '\'' +
18+
", outputIndex=" + getOutputIndex() +
19+
'}';
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.volcengine.ark.runtime.model.responses.event.knowledgesearch;
2+
3+
import com.volcengine.ark.runtime.model.responses.constant.ResponsesConstants;
4+
import com.volcengine.ark.runtime.model.responses.event.ItemEvent;
5+
6+
public class KnowledgeSearchCallFailedEvent extends ItemEvent {
7+
8+
public KnowledgeSearchCallFailedEvent() {
9+
super(ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_FAILED);
10+
}
11+
12+
@Override
13+
public String toString() {
14+
return "KnowledgeSearchCallFailedEvent{" +
15+
"type='" + getType() + '\'' +
16+
", sequenceNumber=" + getSequenceNumber() +
17+
", itemId='" + getItemId() + '\'' +
18+
", outputIndex=" + getOutputIndex() +
19+
'}';
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.volcengine.ark.runtime.model.responses.event.knowledgesearch;
2+
3+
import com.volcengine.ark.runtime.model.responses.constant.ResponsesConstants;
4+
import com.volcengine.ark.runtime.model.responses.event.ItemEvent;
5+
6+
public class KnowledgeSearchCallInProgressEvent extends ItemEvent {
7+
8+
public KnowledgeSearchCallInProgressEvent() {
9+
super(ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_IN_PROGRESS);
10+
}
11+
12+
@Override
13+
public String toString() {
14+
return "KnowledgeSearchCallInProgressEvent{" +
15+
"type='" + getType() + '\'' +
16+
", sequenceNumber=" + getSequenceNumber() +
17+
", itemId='" + getItemId() + '\'' +
18+
", outputIndex=" + getOutputIndex() +
19+
'}';
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.volcengine.ark.runtime.model.responses.event.knowledgesearch;
2+
3+
import com.volcengine.ark.runtime.model.responses.constant.ResponsesConstants;
4+
import com.volcengine.ark.runtime.model.responses.event.ItemEvent;
5+
6+
public class KnowledgeSearchCallSearchingEvent extends ItemEvent {
7+
8+
public KnowledgeSearchCallSearchingEvent() {
9+
super(ResponsesConstants.EVENT_TYPE_RESPONSE_KNOWLEDGE_SEARCH_CALL_SEARCHING);
10+
}
11+
12+
@Override
13+
public String toString() {
14+
return "KnowledgeSearchCallSearchingEvent{" +
15+
"type='" + getType() + '\'' +
16+
", sequenceNumber=" + getSequenceNumber() +
17+
", itemId='" + getItemId() + '\'' +
18+
", outputIndex=" + getOutputIndex() +
19+
'}';
20+
}
21+
}

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/model/responses/item/BaseItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
@JsonSubTypes.Type(value = ItemMCPListTools.class, name = ResponsesConstants.ITEM_TYPE_MCP_LIST_TOOLS),
3333
@JsonSubTypes.Type(value = ItemMCPCall.class, name = ResponsesConstants.ITEM_TYPE_MCP_CALL),
3434

35+
// Knowledge search types
36+
@JsonSubTypes.Type(value = ItemFunctionKnowledgeSearch.class, name = ResponsesConstants.ITEM_TYPE_KNOWLEDGE_SEARCH_CALL),
37+
3538
// DoubaoApp type
3639
@JsonSubTypes.Type(value = ItemDoubaoAppCall.class, name = ResponsesConstants.ITEM_TYPE_DOUBAO_APP_CALL)
3740
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package com.volcengine.ark.runtime.model.responses.item;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import com.volcengine.ark.runtime.model.responses.constant.ResponsesConstants;
6+
7+
import java.util.List;
8+
9+
@JsonIgnoreProperties(ignoreUnknown = true)
10+
public class ItemFunctionKnowledgeSearch extends BaseItem implements InputItem, OutputItem {
11+
12+
@JsonProperty("queries")
13+
private List<String> queries;
14+
15+
@JsonProperty("knowledge_resource_id")
16+
private String knowledgeResourceId;
17+
18+
@JsonProperty("status")
19+
private String status;
20+
21+
@JsonProperty("id")
22+
private String id;
23+
24+
public ItemFunctionKnowledgeSearch() {
25+
super(ResponsesConstants.ITEM_TYPE_KNOWLEDGE_SEARCH_CALL);
26+
}
27+
28+
public List<String> getQueries() {
29+
return queries;
30+
}
31+
32+
public void setQueries(List<String> queries) {
33+
this.queries = queries;
34+
}
35+
36+
public String getKnowledgeResourceId() {
37+
return knowledgeResourceId;
38+
}
39+
40+
public void setKnowledgeResourceId(String knowledgeResourceId) {
41+
this.knowledgeResourceId = knowledgeResourceId;
42+
}
43+
44+
public String getStatus() {
45+
return status;
46+
}
47+
48+
public void setStatus(String status) {
49+
this.status = status;
50+
}
51+
52+
public String getId() {
53+
return id;
54+
}
55+
56+
public void setId(String id) {
57+
this.id = id;
58+
}
59+
60+
@Override
61+
public String toString() {
62+
return "ItemFunctionKnowledgeSearch{" +
63+
"type='" + getType() + '\'' +
64+
", queries=" + queries +
65+
", knowledgeResourceId='" + knowledgeResourceId + '\'' +
66+
", status='" + status + '\'' +
67+
", id='" + id + '\'' +
68+
'}';
69+
}
70+
71+
public static Builder builder() {
72+
return new Builder();
73+
}
74+
75+
public static class Builder {
76+
private List<String> queries;
77+
private String knowledgeResourceId;
78+
private String status;
79+
private String id;
80+
81+
public Builder queries(List<String> queries) {
82+
this.queries = queries;
83+
return this;
84+
}
85+
86+
public Builder knowledgeResourceId(String knowledgeResourceId) {
87+
this.knowledgeResourceId = knowledgeResourceId;
88+
return this;
89+
}
90+
91+
public Builder status(String status) {
92+
this.status = status;
93+
return this;
94+
}
95+
96+
public Builder id(String id) {
97+
this.id = id;
98+
return this;
99+
}
100+
101+
public ItemFunctionKnowledgeSearch build() {
102+
ItemFunctionKnowledgeSearch itemFunctionKnowledgeSearch = new ItemFunctionKnowledgeSearch();
103+
itemFunctionKnowledgeSearch.setQueries(queries);
104+
itemFunctionKnowledgeSearch.setKnowledgeResourceId(knowledgeResourceId);
105+
itemFunctionKnowledgeSearch.setStatus(status);
106+
itemFunctionKnowledgeSearch.setId(id);
107+
return itemFunctionKnowledgeSearch;
108+
}
109+
}
110+
}

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/model/responses/tool/ResponsesTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@JsonSubTypes.Type(value = ToolWebSearch.class, name = "web_search"),
1717
@JsonSubTypes.Type(value = ToolImageProcess.class, name = "image_process"),
1818
@JsonSubTypes.Type(value = ToolMCP.class, name = "mcp"),
19+
@JsonSubTypes.Type(value = ToolKnowledgeSearch.class, name = "knowledge_search"),
1920
@JsonSubTypes.Type(value = ToolDoubaoApp.class, name = "doubao_app")
2021
})
2122
public abstract class ResponsesTool {

0 commit comments

Comments
 (0)