Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/src/main/java/ai/z/openapi/service/model/ModelData.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -54,4 +55,6 @@ public final class ModelData {

private String delta;

private KnowledgeV2Result knowledgeV2;

}
6 changes: 6 additions & 0 deletions core/src/main/java/ai/z/openapi/service/model/ToolCalls.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -35,4 +38,7 @@ public class ToolCalls {
@JsonProperty("mcp")
private MCPToolCall mcp;

@JsonProperty("doc_reference")
private List<DocReference> docReferenceList;

}
26 changes: 26 additions & 0 deletions core/src/main/java/ai/z/openapi/service/tools/DocReference.java
Original file line number Diff line number Diff line change
@@ -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;

}
165 changes: 165 additions & 0 deletions core/src/main/java/ai/z/openapi/service/tools/KnowledgeV2Result.java
Original file line number Diff line number Diff line change
@@ -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;

}

}