Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add account/corpus management APIs #25

Merged
merged 7 commits into from
Jan 2, 2024
78 changes: 78 additions & 0 deletions admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,84 @@ message ListCorporaResponse {
Status status = 1000;
}

message UpdateCorpusEnablementRequest {
// The corpus to enable or disable.
uint32 corpus_id = 1;
// If true, enable the corpus. Otherwise, disable it.
bool enable = 2;
}

message UpdateCorpusEnablementResponse {
Status status = 1;
}

message CorpusSize {
// The time at which the size was calculated.
int64 epoch_secs = 1;

// The size of the corpus.
uint64 size = 2;
}

message ReadCorpusRequest {
// Corpora IDs to read.
repeated uint32 corpus_id = 1;

// Subset of information to read.
// Set to true to read basic information about the corpus such as id, name,
// description, enabled, etc.
bool read_basic_info = 1000;
// Set to true to read the size of the corpus.
bool read_size = 1001;
// Set to true to read the API keys associated with the corpus.
bool read_api_keys = 1003;
// Set to true to read the custom dimensions of the corpus.
bool read_custom_dimensions = 1004;
// Set to true to read the filter attributes of the corpus.
bool read_filter_attributes = 1005;
}

message ReadCorpusResponse {
// A Corpus information object containing the requested information.
message CorpusInfo {
// Only requested fields are populated.
Corpus corpus = 1;
// Status of the corpus.
Status corpus_status = 1001;
// Size of the corpus. Only populated if read_size is true.
CorpusSize size = 2;
// Status of the size.
Status size_status = 1002;
// API keys associated with the corpus. Only populated if read_api_keys is true.
repeated ApiKey api_key = 4;
// Status of the API keys.
Status api_key_status = 1004;
// Custom dimensions of the corpus. Only populated if read_custom_dimensions is true.
repeated Dimension custom_dimension = 5;
// Status of the custom dimensions.
Status custom_dimension_status = 1005;
// Filter attributes of the corpus. Only populated if read_filter_attributes is true.
repeated FilterAttribute filter_attribute = 6;
// Status of the filter attributes.
Status filter_attribute_status = 1006;
}

// Information about the requested corpora.
repeated CorpusInfo corpora = 1;
}

message ComputeCorpusSizeRequest {
// The corpus for which to compute the size.
uint32 corpus_id = 1;
}

message ComputeCorpusSizeResponse {
// The size of the corpus.
CorpusSize size = 1;
// The status of the size computation.
Status status = 2;
}

message ReplaceCorpusFilterAttrsRequest {
// The corpus for which to update filters.
uint32 corpus_id = 1;
Expand Down
33 changes: 33 additions & 0 deletions admin_account.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";

import "status.proto";

option go_package = "vectara.com/public/proto/admin";

option java_package = "com.vectara.admin";
option java_outer_classname = "AdminAccountProtos";

package com.vectara.admin;

// Please note that this is an expensive operation, and the requests can be throttled
// by the platform.
message ComputeAccountSizeRequest {
}

// A TextSize object represents the size of stored text.
message TextSize {
// Count of actual characters in the text that will be searched.
uint64 num_chars = 1;
// Count of metadata characters such as URL, author, date of creation etc.
uint64 num_metadata_chars = 2;
}

message ComputeAccountSizeResponse {
// One TextSize represents one cluster. The account size is a sum of all the sizes.
// Generally, this will only have one value.
repeated TextSize size = 1;
// Status response of the operation.
Status status = 2;
}


34 changes: 33 additions & 1 deletion services.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
syntax = "proto3";

import "admin_account.proto";
import "admin_apikey.proto";
import "admin.proto";
import "admin_job.proto";
Expand All @@ -10,7 +11,6 @@ import "common.proto";
import "indexing.proto";
import "serving.proto";
import "status.proto";
// import "list_documents.proto";
import "google/api/annotations.proto";

option java_package = "com.vectara";
Expand Down Expand Up @@ -111,6 +111,31 @@ service AdminService {
};
}

// Return information about corpora.
rpc ReadCorpus(com.vectara.admin.ReadCorpusRequest)
returns (com.vectara.admin.ReadCorpusResponse) {
option (google.api.http) = {
post: "/v1/read-corpus"
body: "*"
};
}

rpc ComputeCorpusSize(com.vectara.admin.ComputeCorpusSizeRequest)
returns (com.vectara.admin.ComputeCorpusSizeResponse) {
option (google.api.http) = {
post: "/v1/compute-corpus-size"
body: "*"
};
}

rpc ComputeAccountSize(com.vectara.admin.ComputeAccountSizeRequest)
returns (com.vectara.admin.ComputeAccountSizeResponse) {
option (google.api.http) = {
post: "/v1/compute-account-size"
body: "*"
};
}

rpc ListUsers(com.vectara.admin.ListUsersRequest)
returns (com.vectara.admin.ListUsersResponse) {
option (google.api.http) = {
Expand All @@ -127,6 +152,13 @@ service AdminService {
};
}

rpc UpdateCorpusEnablement(com.vectara.admin.UpdateCorpusEnablementRequest) returns (com.vectara.admin.UpdateCorpusEnablementResponse) {
option (google.api.http) = {
post: "/v1/update-corpus-enablement"
body: "*"
};
}

rpc ReplaceCorpusFilterAttrs(com.vectara.admin.ReplaceCorpusFilterAttrsRequest) returns (com.vectara.admin.ReplaceCorpusFilterAttrsResponse) {
option (google.api.http) = {
post: "/v1/replace-corpus-filter-attrs"
Expand Down
1 change: 1 addition & 0 deletions serving.proto
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ message QueryRequest {

}


message Attribute {
string name = 5;
string value = 10;
Expand Down