feat: Add event fields for knowledge retrieval V2. (#85)
Co-authored-by: yuhongxiao <hongxiao.yu@aminer.cn> Co-authored-by: Tomsun28 <tomsun28@outlook.com>
This commit is contained in:
parent
5e754f837a
commit
2ae792a034
4 changed files with 200 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package ai.z.openapi.service.model;
|
||||
|
||||
import ai.z.openapi.service.tools.KnowledgeV2Result;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import ai.z.openapi.service.web_search.WebSearchResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -54,4 +55,6 @@ public final class ModelData {
|
|||
|
||||
private String delta;
|
||||
|
||||
private KnowledgeV2Result knowledgeV2;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
package ai.z.openapi.service.model;
|
||||
|
||||
import ai.z.openapi.service.tools.DocReference;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents tool calls made by the model during conversation. This class contains
|
||||
* information about function calls including the function details, unique identifier, and
|
||||
|
|
@ -35,4 +38,7 @@ public class ToolCalls {
|
|||
@JsonProperty("mcp")
|
||||
private MCPToolCall mcp;
|
||||
|
||||
@JsonProperty("doc_reference")
|
||||
private List<DocReference> docReferenceList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package ai.z.openapi.service.tools;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DocReference implements Serializable {
|
||||
|
||||
/** Document index */
|
||||
private Integer index;
|
||||
|
||||
/** Document type */
|
||||
private String doc_type;
|
||||
|
||||
/** Document name */
|
||||
private String doc_name;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
package ai.z.openapi.service.tools;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/** Knowledge base retrieval V2 result */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class KnowledgeV2Result implements Serializable {
|
||||
|
||||
/** List of data sources */
|
||||
private List<Content> contents;
|
||||
|
||||
/** Query rewrite result */
|
||||
private RewrittenQuery rewritten_query;
|
||||
|
||||
private String type;
|
||||
|
||||
/** Data source */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Content {
|
||||
|
||||
/** Chunk ID (uuid) */
|
||||
private String id;
|
||||
|
||||
/** Modality type: text, image_url, video_url */
|
||||
private String type;
|
||||
|
||||
/** Text content */
|
||||
private String text;
|
||||
|
||||
/** List of media files in text */
|
||||
private List<Media> medias;
|
||||
|
||||
/** Image URL object */
|
||||
private ImageUrl image_url;
|
||||
|
||||
/** Video URL object */
|
||||
private VideoUrl video_url;
|
||||
|
||||
/** Recall position (rankIndex) */
|
||||
private Integer index;
|
||||
|
||||
/** Recall score (rankScore) */
|
||||
private Double score;
|
||||
|
||||
/** Rerank position (rerankIndex) */
|
||||
private Integer rerank_index;
|
||||
|
||||
/** Rerank score (rerankScore) */
|
||||
private Double rerank_score;
|
||||
|
||||
/** Metadata */
|
||||
private MetadataDTO metadata;
|
||||
|
||||
}
|
||||
|
||||
/** Media file */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Media {
|
||||
|
||||
/** Image ID */
|
||||
private String id;
|
||||
|
||||
/** Image URL */
|
||||
private String url;
|
||||
|
||||
/** Image description */
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
||||
/** Image URL object */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class ImageUrl {
|
||||
|
||||
/** URL */
|
||||
private String url;
|
||||
|
||||
}
|
||||
|
||||
/** Video URL object */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class VideoUrl {
|
||||
|
||||
/** URL */
|
||||
private String url;
|
||||
|
||||
}
|
||||
|
||||
/** Metadata */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class MetadataDTO {
|
||||
|
||||
/** Chunk ID */
|
||||
private String _id;
|
||||
|
||||
/** Knowledge base ID */
|
||||
private String know_id;
|
||||
|
||||
/** Document ID */
|
||||
private String doc_id;
|
||||
|
||||
/** Document type (dtype) */
|
||||
private String doc_type;
|
||||
|
||||
/** Document name (filename) */
|
||||
private String doc_name;
|
||||
|
||||
/** Document URL */
|
||||
private String doc_url;
|
||||
|
||||
/** Chunk index */
|
||||
private Integer index;
|
||||
|
||||
/** Document page number */
|
||||
private Integer page_index;
|
||||
|
||||
/** Video clip index */
|
||||
private Integer clip_index;
|
||||
|
||||
/** Start frame timestamp */
|
||||
private Long start_time;
|
||||
|
||||
/** End frame timestamp */
|
||||
private Long end_time;
|
||||
|
||||
/** Video clip duration */
|
||||
private Long duration;
|
||||
|
||||
/** Key frame list */
|
||||
private List<Object> frames;
|
||||
|
||||
}
|
||||
|
||||
/** Query rewrite result */
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class RewrittenQuery {
|
||||
|
||||
/** Primary query */
|
||||
private String primary_query;
|
||||
|
||||
/** Alternative query list */
|
||||
private List<String> multi_queries;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue