syntax = "proto3";

package nominal.ai.v1;

// KnowledgeBaseService provides AI-powered knowledge base management
service KnowledgeBaseService {
  // CreateOrUpdateKnowledgeBase creates a knowledge base in the workspace
  rpc CreateOrUpdateKnowledgeBase(CreateOrUpdateKnowledgeBaseRequest) returns (CreateOrUpdateKnowledgeBaseResponse);
}

// KnowledgeBaseType defines the types of knowledge base
enum KnowledgeBaseType {
  KNOWLEDGE_BASE_TYPE_UNSPECIFIED = 0; // defaults to PROMPT
  KNOWLEDGE_BASE_TYPE_PROMPT = 1; // knowledge base gets added directly to prompt (needs to be small enough!)
  KNOWLEDGE_BASE_TYPE_EMBEDDING = 2; // knowledge base gets used via vector search on embeddings
}

// CreateOrUpdateKnowledgeBaseRequest is a request to create a knowledge from an attachment in the attachment's
// workspace. Subsequent calls for the same attachment will overwrite the existing knowledge base.
message CreateOrUpdateKnowledgeBaseRequest {
  string attachment_rid = 1;
  string summary_description = 2; // summary of the knowledge base, will be used by the LLM to decide when to use it
  KnowledgeBaseType type = 3;
}

// CreateOrUpdateKnowledgeBaseResponse is the response to creating/updating a knowledge base
message CreateOrUpdateKnowledgeBaseResponse {
  string knowledge_base_rid = 1;
}
