syntax = "proto3";

package protocols.grpc.retrieval;

import "protocols/grpc/common/common.proto";
import "google/protobuf/struct.proto";

// Retrieval Brick 相關訊息
message RetrievalRequest {
  string query = 1;
  int32 max_results = 2;  // 最多回傳數量
  string client_id = 3;
  string session_id = 4;
  string request_id = 5;
  string source_language = 6;
}

message Document {
  string doc_id = 1;
  string title = 2;
  string snippet = 3;       // 簡短摘錄
  float score = 4;          // 相似度分數
  google.protobuf.Struct metadata = 5; // 可擴展欄位
}

message RetrievalResponse {
  repeated Document documents = 1;
  protocols.grpc.common.ErrorDetail error = 2;
}

service RetrievalService {
  rpc GetServiceInfo(protocols.grpc.common.ServiceInfoRequest) returns (protocols.grpc.common.ServiceInfoResponse);
  rpc Unary(RetrievalRequest) returns (RetrievalResponse);
}
