Models Proto DefinitionΒΆ

  1syntax = "proto3";
  2
  3package athena;
  4
  5option csharp_namespace = "Resolver.Athena.Grpc";
  6option java_outer_classname = "AthenaModelsProto";
  7option java_package = "com.resolver.athena.grpc";
  8option objc_class_prefix = "RAT";
  9option php_namespace = "Resolver\\Athena\\Grpc";
 10option ruby_package = "Resolver::Athena::Grpc";
 11option swift_prefix = "RAT";
 12
 13// Response message for ListDeployments RPC
 14// Contains the list of active deployments and their details.
 15message ListDeploymentsResponse {
 16  // List of active deployments with their backlog information.
 17  repeated Deployment deployments = 1;
 18}
 19
 20// A single active deployment part of a `ListDeployments` response
 21message Deployment {
 22  // active deployment identifier
 23  string deployment_id = 1;
 24
 25  // Backlog of classification responses in this deployment
 26  int32 backlog = 2;
 27}
 28
 29// The request message containing the image data to classify.
 30// Each request represents a batch of images that should be processed within
 31// the same deployment context.
 32message ClassifyRequest {
 33  // Client's unique identifier for this deployment. Responses returned will be
 34  // sent to a client with a matching deployment_id.
 35  string deployment_id = 1;
 36
 37  // Array of images to be classified in this request batch
 38  // Allows sending multiple images in a single request for efficiency.
 39  repeated ClassificationInput inputs = 2;
 40}
 41
 42// A single image within a classification request batch.
 43// Contains all necessary metadata and data for classifying one image.
 44message ClassificationInput {
 45  // The affiliate or source system that provided this image
 46  // Used for tracking, analytics, and routing purposes.
 47  string affiliate = 1;
 48
 49  // Unique identifier for correlating this input with its response
 50  // Must be unique within the deployment to properly match responses
 51  string correlation_id = 2;
 52
 53  // Specifies the encoding/compression format of the image data
 54  // Allows the server to properly decode the image before classification
 55  RequestEncoding encoding = 3;
 56
 57  // The raw image data bytes in the format specified by encoding
 58  // Can be compressed or uncompressed based on the encoding field
 59  bytes data = 4;
 60
 61  // The image file format of the data bytes
 62  ImageFormat format = 5;
 63
 64  // Hashes of the image data, can be multiple depending on image processing
 65  // (e.g. of raw bytes, jpeg image, etc.) but must be for a single image.
 66  repeated ImageHash hashes = 6;
 67}
 68
 69// The response message containing the classification results.
 70// Sent back to clients for each processed batch, containing either
 71// a global error or individual results for each image in the batch.
 72message ClassifyResponse {
 73  // Global error affecting the entire batch/request
 74  // If present, indicates that the entire request failed and no individual
 75  // image results will be provided
 76  ClassificationError global_error = 1;
 77
 78  // Array of classification results, one for each input image
 79  // Will be empty if global_error is present
 80  repeated ClassificationOutput outputs = 2;
 81}
 82
 83// Individual classification result for a single image.
 84// Contains the correlation ID and classification results for one image.
 85message ClassificationOutput {
 86  // Matches the correlationId from the corresponding ClassificationInput
 87  // Allows clients to match responses with their original requests
 88  string correlation_id = 1;
 89
 90  // Array of all classifications detected for this image
 91  // Multiple classifications may be returned with different confidence levels
 92  repeated Classification classifications = 2;
 93
 94  // Error information if this specific image classification failed
 95  // If present, indicates that this particular image could not be processed
 96  ClassificationError error = 3;
 97}
 98
 99// A single classification result for an image.
100// Represents one detected category with its confidence score.
101message Classification {
102  // Human-readable label describing what was classified
103  // Examples: "CatA", "CatB", "Indicative", "Distraction", etc.
104  string label = 1;
105
106  // Confidence score between 0.0 and 1.0 indicating certainty
107  // Higher values indicate greater confidence in the classification
108  float weight = 2;
109}
110
111// Error information for failed classification attempts.
112// Provides details about why a classification could not be completed.
113message ClassificationError {
114  // Error code indicating the type of failure
115  ErrorCode code = 1;
116
117  // Human-readable error message providing details about the failure
118  string message = 2;
119
120  // Additional context or details about the error (optional)
121  string details = 3;
122}
123
124// Hash information for an image.
125message ImageHash {
126    // The hash value of the image data
127    string value = 1;
128
129    // The type of hash algorithm used to generate the hash value
130    HashType type = 2;
131}
132
133// Enumeration of possible classification error codes.
134enum ErrorCode {
135  // Unknown or unspecified error
136  ERROR_CODE_UNSPECIFIED = 0;
137
138  // Image is too large to process
139  ERROR_CODE_IMAGE_TOO_LARGE = 2;
140
141  // Opaque error from the classifier
142  ERROR_CODE_MODEL_ERROR = 3;
143
144  // Attempt to send data for an affiliate which is not granted to the current
145  // client.
146  ERROR_CODE_AFFILIATE_NOT_PERMITTED = 4;
147
148  // The format of the deployment ID is not valid. Deployment IDs must be
149  // non-empty strings of up to 64 characters.
150  ERROR_CODE_DEPLOYMENT_ID_INVALID = 5;
151
152  // The format of the correlation ID is not valid. Correlation IDs must be
153  // non-empty strings of up to 64 characters.
154  ERROR_CODE_CORRELATION_ID_INVALID = 6;
155}
156
157// Enumeration of supported image data encoding formats.
158// Determines how the server should interpret the image data bytes.
159enum RequestEncoding {
160  // Unspecified encoding. Assumed to be uncompressed.
161  REQUEST_ENCODING_UNSPECIFIED = 0;
162
163  // Uncompressed raw image data (e.g., raw RGB pixels, BMP, etc.)
164  REQUEST_ENCODING_UNCOMPRESSED = 1;
165
166  // Brotli-compressed image data for reduced bandwidth usage
167  // Server will decompress using Brotli algorithm before processing
168  REQUEST_ENCODING_BROTLI = 2;
169}
170
171// Enumeration of supported image file formats.
172// Specifies the image file format structure for proper parsing.
173enum ImageFormat {
174  IMAGE_FORMAT_UNSPECIFIED = 0;
175  IMAGE_FORMAT_GIF = 1;
176  IMAGE_FORMAT_JPEG = 2; // Covers .jpeg, .jpg, .jpe extensions
177  IMAGE_FORMAT_BMP = 3;
178  IMAGE_FORMAT_DIB = 4;
179  IMAGE_FORMAT_PNG = 5;
180  IMAGE_FORMAT_WEBP = 6;
181  IMAGE_FORMAT_PBM = 7;
182  IMAGE_FORMAT_PGM = 8;
183  IMAGE_FORMAT_PPM = 9;
184  IMAGE_FORMAT_PXM = 10;
185  IMAGE_FORMAT_PNM = 11;
186  IMAGE_FORMAT_PFM = 12;
187  IMAGE_FORMAT_SR = 13;
188  IMAGE_FORMAT_RAS = 14;
189  IMAGE_FORMAT_TIFF = 15; // Covers .tiff, .tif extensions
190  IMAGE_FORMAT_HDR = 16;
191  IMAGE_FORMAT_PIC = 17;
192  IMAGE_FORMAT_RAW_UINT8 = 18; // Raw unsigned 8-bit image data (RGB, C order array)
193}
194
195// Enumeration of hash types supported for image hashing.
196enum HashType {
197    HASH_TYPE_UNKNOWN = 0;
198    HASH_TYPE_MD5 = 1;
199    HASH_TYPE_SHA1 = 2;
200}