11syntax = "proto3" ;
2- import "google/protobuf/descriptor.proto" ;
2+ import "google/protobuf/descriptor.proto" ; // Required for indicators to work
33package training ;
4- option go_package = "../training" ;
5- //Please note that the AI developers need to provide a server implementation of the gprc server of this proto.
6- message ModelDetails {
7- //This Id will be generated when you invoke the create_model method and hence doesnt need to be filled when you
8- //invoke the create model
9- string model_id = 1 ;
10- //define the training method name
11- string grpc_method_name = 2 ;
12- //define the grpc service name , under which the method is defined
13- string grpc_service_name = 3 ;
14- string description = 4 ;
4+ option go_package = "github.com/singnet/snet-daemon/v5/training" ;
155
16- string status = 6 ;
17- string updated_date = 7 ;
18- //List of all the addresses that will have access to this model
19- repeated string address_list = 8 ;
20- // this is optional
21- string training_data_link = 9 ;
22- string model_name = 10 ;
6+ // Methods that the service provider must implement
7+ service Model {
238
9+ // Free
10+ // Can pass the address of the model creator
11+ rpc create_model (NewModel ) returns (ModelID ) {}
2412
25- string organization_id = 11 ;
26- string service_id = 12 ;
27- string group_id = 13 ;
13+ // Free
14+ rpc validate_model_price (ValidateRequest ) returns (PriceInBaseUnit ) {}
2815
29- //set this to true if you want your model to be used by other AI consumers
30- bool is_publicly_accessible = 14 ;
16+ // Paid
17+ rpc upload_and_validate ( stream UploadInput ) returns ( StatusResponse ) {}
3118
32- }
19+ // Paid
20+ rpc validate_model (ValidateRequest ) returns (StatusResponse ) {}
3321
34- message AuthorizationDetails {
35- uint64 current_block = 1 ;
36- //Signer can fill in any message here
37- string message = 2 ;
38- //signature of the following message:
39- //("user specified message", user_address, current_block_number)
40- bytes signature = 3 ;
41- string signer_address = 4 ;
22+ // Free, one signature for both train_model_price & train_model methods
23+ rpc train_model_price (ModelID ) returns (PriceInBaseUnit ) {}
4224
43- }
25+ // Paid
26+ rpc train_model (ModelID ) returns (StatusResponse ) {}
4427
45- enum Status {
46- CREATED = 0 ;
47- IN_PROGRESS = 1 ;
48- ERRORED = 2 ;
49- COMPLETED = 3 ;
50- DELETED = 4 ;
51- }
28+ // Free
29+ rpc delete_model (ModelID ) returns (StatusResponse ) {
30+ // After model deletion, the status becomes DELETED in etcd
31+ }
5232
53- message CreateModelRequest {
54- AuthorizationDetails authorization = 1 ;
55- ModelDetails model_details = 2 ;
33+ // Free
34+ rpc get_model_status (ModelID ) returns (StatusResponse ) {}
5635}
5736
58- //the signer address will get to know all the models associated with this address.
59- message AccessibleModelsRequest {
60- string grpc_method_name = 1 ;
61- string grpc_service_name = 2 ;
62- AuthorizationDetails authorization = 3 ;
63- }
37+ message ModelResponse {
38+ string model_id = 1 ;
39+ Status status = 2 ;
40+ string created_date = 3 ;
41+ string updated_date = 4 ;
42+ string name = 5 ;
43+ string description = 6 ;
44+ string grpc_method_name = 7 ;
45+ string grpc_service_name = 8 ;
6446
65- message AccessibleModelsResponse {
66- repeated ModelDetails list_of_models = 1 ;
67- }
47+ // List of all addresses that will have access to this model
48+ repeated string address_list = 9 ;
49+
50+ // Access to the model is granted only for use and viewing
51+ bool is_public = 10 ;
52+
53+ string training_data_link = 11 ;
6854
69- message ModelDetailsRequest {
70- ModelDetails model_details = 1 ;
71- AuthorizationDetails authorization = 2 ;
55+ string created_by_address = 12 ;
56+ string updated_by_address = 13 ;
7257}
7358
74- //helps determine which service end point to call for model training
75- //format is of type "packageName/serviceName/MethodName", Example :"/example_service.Calculator/estimate_add"
76- //Daemon will invoke the model training end point , when the below method option is specified
77- message TrainingMethodOption {
78- string trainingMethodIndicator = 1 ;
59+ // Used as input for new_model requests
60+ // The service provider decides whether to use these fields; returning model_id is mandatory
61+ message NewModel {
62+ string name = 1 ;
63+ string description = 2 ;
64+ string grpc_method_name = 3 ;
65+ string grpc_service_name = 4 ;
66+
67+ // List of all addresses that will have access to this model
68+ repeated string address_list = 5 ;
69+
70+ // Set this to true if you want your model to be accessible by other AI consumers
71+ bool is_public = 6 ;
72+
73+ // These parameters will be passed by the daemon
74+ string organization_id = 7 ;
75+ string service_id = 8 ;
76+ string group_id = 9 ;
7977}
8078
81- extend google.protobuf.MethodOptions {
82- TrainingMethodOption my_method_option = 9999197 ;
79+ // This structure must be used by the service provider
80+ message ModelID {
81+ string model_id = 1 ;
8382}
8483
85- message UpdateModelRequest {
86- ModelDetails update_model_details = 1 ;
87- AuthorizationDetails authorization = 2 ;
84+ // This structure must be used by the service provider
85+ // Used in the train_model_price method to get the training/validation price
86+ message PriceInBaseUnit {
87+ uint64 price = 1 ; // cogs, weis, afet, aasi, etc.
8888}
8989
90+ enum Status {
91+ CREATED = 0 ;
92+ VALIDATING = 1 ;
93+ VALIDATED = 2 ;
94+ TRAINING = 3 ;
95+ READY_TO_USE = 4 ; // After training is completed
96+ ERRORED = 5 ;
97+ DELETED = 6 ;
98+ }
9099
91- message ModelDetailsResponse {
100+ message StatusResponse {
92101 Status status = 1 ;
93- ModelDetails model_details = 2 ;
94-
95102}
96103
97- service Model {
98-
99- // The AI developer needs to Implement this service and Daemon will call these
100- // There will be no cost borne by the consumer in calling these methods,
101- // Pricing will apply when you actually call the training methods defined.
102- // AI consumer will call all these methods
103- rpc create_model (CreateModelRequest ) returns (ModelDetailsResponse ) {}
104- rpc delete_model (UpdateModelRequest ) returns (ModelDetailsResponse ) {}
105- rpc get_model_status (ModelDetailsRequest ) returns (ModelDetailsResponse ) {}
106-
107- // Daemon will implement , however the AI developer should skip implementing these and just provide dummy code.
108- rpc update_model_access (UpdateModelRequest ) returns (ModelDetailsResponse ) {}
109- rpc get_all_models (AccessibleModelsRequest ) returns (AccessibleModelsResponse ) {}
104+ message UploadInput {
105+ string model_id = 1 ;
106+ bytes data = 2 ;
107+ string file_name = 3 ;
108+ uint64 file_size = 4 ; // in bytes
109+ uint64 batch_size = 5 ;
110+ uint64 batch_number = 6 ;
111+ uint64 batch_count = 7 ;
112+ }
110113
114+ message ValidateRequest {
115+ string model_id = 2 ;
116+ string training_data_link = 3 ;
117+ }
111118
112- }
119+ extend google.protobuf.MethodOptions {
120+ string default_model_id = 50001 ;
121+ uint64 max_models_per_user = 50002 ; // max models per method & user
122+ uint64 dataset_max_size_mb = 50003 ; // max size of dataset
123+ uint64 dataset_max_count_files = 50004 ; // maximum number of files in the dataset
124+ uint64 dataset_max_size_single_file_mb = 50005 ; // maximum size of a single file in the dataset
125+ string dataset_files_type = 50006 ; // allowed files types in dataset. string with array or single value, example: jpg, png, mp3
126+ string dataset_type = 50007 ; // string with array or single value, example: zip, tar.gz, tar
127+ string dataset_description = 50008 ; // additional free-form requirements
128+ }
0 commit comments