Skip to content

Commit 5c8b4db

Browse files
authored
feat(artifact): add ResetKnowledgeBaseEmbeddingsAdmin RPC for BM25 migration (#722)
**Because** - Existing default knowledge bases in Zilliz Cloud may not have BM25 native hybrid search support enabled in their Milvus collection schema - The `convert000070` migration needs a way to reset KB embeddings so that new Milvus collections with BM25-enabled schema can be created - There was no admin API to trigger a full embedding reset (drop collection + clear PostgreSQL data + reset file statuses) **This commit** - Adds `ResetKnowledgeBaseEmbeddingsAdmin` RPC to `ArtifactPrivateService` that resets all embeddings for a knowledge base - Adds `ResetKnowledgeBaseEmbeddingsAdminRequest` and `ResetKnowledgeBaseEmbeddingsAdminResponse` message types in `knowledge_base.proto` - Updates comment in `file.proto` to reflect hash-based ID format (`col-xxx`) instead of UUID - Applies formatting improvements (line breaks) to long RPC declarations for better readability
1 parent 6c75583 commit 5c8b4db

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

artifact/v1alpha/artifact_private_service.proto

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ service ArtifactPrivateService {
3939
//
4040
// Updates a file allowing system-reserved tag prefixes like "agent:".
4141
// Used by agent-backend to set collection association tags (e.g.,
42-
// "agent:collection:{uid}").
42+
// "agent:collection:{id}" where {id} is hash-based like col-xxx).
4343
rpc UpdateFileAdmin(UpdateFileAdminRequest) returns (UpdateFileAdminResponse);
4444

4545
// Get Object (admin only)
@@ -122,4 +122,7 @@ service ArtifactPrivateService {
122122

123123
// Get the current default system configuration (admin only)
124124
rpc GetDefaultSystemAdmin(GetDefaultSystemAdminRequest) returns (GetDefaultSystemAdminResponse);
125+
126+
// Reset knowledge base embeddings (admin only)
127+
rpc ResetKnowledgeBaseEmbeddingsAdmin(ResetKnowledgeBaseEmbeddingsAdminRequest) returns (ResetKnowledgeBaseEmbeddingsAdminResponse);
125128
}

artifact/v1alpha/file.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ message ReprocessFileResponse {
542542
// UpdateFileAdminRequest represents a request to update a file with
543543
// system-reserved tags (admin only). Used by internal services like
544544
// agent-backend to set tags with reserved prefixes (e.g.,
545-
// "agent:collection:{uid}").
545+
// "agent:collection:{id}" where {id} is hash-based like col-xxx).
546546
// Follows AIP-134: https://google.aip.dev/134
547547
message UpdateFileAdminRequest {
548548
// The file resource to update. The file's `name` field identifies the

artifact/v1alpha/knowledge_base.proto

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,23 @@ message UpdateKnowledgeBaseAdminResponse {
314314
// The updated knowledge base resource.
315315
KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
316316
}
317+
318+
// ResetKnowledgeBaseEmbeddingsAdminRequest represents a request to reset all
319+
// embeddings for a knowledge base (admin only).
320+
message ResetKnowledgeBaseEmbeddingsAdminRequest {
321+
// The resource name of the knowledge base to reset embeddings for.
322+
// Format: `namespaces/{namespace}/knowledge-bases/{knowledge_base}`
323+
string name = 1 [
324+
(google.api.field_behavior) = REQUIRED,
325+
(google.api.resource_reference) = {type: "api.instill.tech/KnowledgeBase"}
326+
];
327+
}
328+
329+
// ResetKnowledgeBaseEmbeddingsAdminResponse represents a response for resetting
330+
// knowledge base embeddings.
331+
message ResetKnowledgeBaseEmbeddingsAdminResponse {
332+
// The knowledge base that had its embeddings reset.
333+
KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
334+
// Number of files that will be re-embedded.
335+
int32 files_to_reembed = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
336+
}

0 commit comments

Comments
 (0)