Skip to content

Commit

Permalink
Merge 1823024 into 0f4071f
Browse files Browse the repository at this point in the history
  • Loading branch information
Yougigun authored Aug 5, 2024
2 parents 0f4071f + 1823024 commit e974755
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 0 deletions.
10 changes: 10 additions & 0 deletions artifact/artifact/v1alpha/artifact.proto
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ enum FileType {
FILE_TYPE_JPEG = 5;
// JPG
FILE_TYPE_JPG = 6;
// HTML
FILE_TYPE_HTML = 7;
// DOCX
FILE_TYPE_DOCX = 8;
// DOC
FILE_TYPE_DOC = 9;
// PPT
FILE_TYPE_PPT = 10;
// PPTX
FILE_TYPE_PPTX = 11;
}

// file mata data
Expand Down
19 changes: 19 additions & 0 deletions artifact/artifact/v1alpha/artifact_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package artifact.artifact.v1alpha;
// Artifact definitions
import "artifact/artifact/v1alpha/artifact.proto";
import "artifact/artifact/v1alpha/chunk.proto";
import "artifact/artifact/v1alpha/file_catalog.proto";
import "artifact/artifact/v1alpha/qa.proto";
// Google API
import "google/api/annotations.proto";
import "google/api/visibility.proto";
Expand Down Expand Up @@ -128,4 +130,21 @@ service ArtifactPublicService {
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Catalog"};
}

// Question Answering
rpc QuestionAnswering(QARequest) returns (QAResponse) {
option (google.api.http) = {
post: "/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/qa"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Catalog"};
}

// Get file catalog
rpc GetFileCatalog(GetFileCatalogRequest) returns (GetFileCatalogResponse) {
option (google.api.http) = {
get: "/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/file-catalog"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {tags: "Catalog"};
}
}
91 changes: 91 additions & 0 deletions artifact/artifact/v1alpha/file_catalog.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
syntax = "proto3";

package artifact.artifact.v1alpha;
// Artifact definitions
import "artifact/artifact/v1alpha/artifact.proto";

// Protocol Buffers Well-Known Types
import "google/protobuf/timestamp.proto";

// GetFileCatalogRequest
message GetFileCatalogRequest{
// id of the namespace
string namespaceId = 1;
// id of the catalog
string catalogId = 2;
// id of the file(i.e. file name)
string fileId = 3;
// Uid of the file
string fileUid = 4;
}

// GetFileCatalogResponse
message GetFileCatalogResponse{
// metadata
message Metadata {
// file uid
string fileUid = 1;
// file id
string fileId = 2;
// file type
FileType fileType = 3;
// file size in bytes
int64 fileSize = 4;
// upload time
google.protobuf.Timestamp fileUploadTime = 5;
FileProcessStatus fileProcessStatus = 6;
}
// text message
message Text{
// pipelines
repeated string pipelineIds = 1;
// transformed content
string transformedContent = 2;
// transformed content uid
string transformedContentUid = 3;
// transformed content chunk number
int32 transformedContentChunkNumber = 4;
// transformed content token number
int32 transformedContentTokenNumber = 5;
// transformed content update time
google.protobuf.Timestamp transformedContentUpdateTime = 6;
}
// chunk type
enum ChunkType {
// text
CHUNK_TYPE_TEXT = 0;
// image
CHUNK_TYPE_IMAGE = 1;
// audio
CHUNK_TYPE_AUDIO = 2;
// video
CHUNK_TYPE_VIDEO = 3;
}
// chunk message
message Chunk {
// chunk uid
string uid = 1;
// chunk type. i.e. text, image, audio, and video
ChunkType type = 2;
// chunk start position
int32 startPos = 3;
// chunk end position
int32 endPos =4;
// chunk content
string content = 5;
// chunk tokens num
int32 tokensNum = 6;
// embedding. float32 array
repeated float embedding = 7;
// chunk create time
google.protobuf.Timestamp createTime = 8;
// chunk retrievable
bool retrievable = 9;
}
// file catalog
Metadata metadata = 1;
// text
Text text = 2;
// chunks
repeated Chunk chunks = 3;
}
28 changes: 28 additions & 0 deletions artifact/artifact/v1alpha/qa.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package artifact.artifact.v1alpha;

// Artifact definitions
import "artifact/artifact/v1alpha/chunk.proto";


// QARequest represents a request for the Question Answering service
message QARequest {
// id of the namespace
string namespaceId = 1;
// id of the catalog
string catalogId = 2;
// question to be answered
string question = 3;
// topk default to 5
int32 topk = 4;
}

// QAResponse represents a response from the Question Answering service
message QAResponse {
// answer to the question
string answer = 1;
// chunks
repeated SimilarityChunk similarChunks = 2;
}

0 comments on commit e974755

Please sign in to comment.