diff --git a/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.go b/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.go index 9b38a75..60165c2 100644 --- a/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.go +++ b/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.go @@ -24,11 +24,13 @@ const ( type AIModelError int32 const ( - AIModelError_NO_ERROR AIModelError = 0 - AIModelError_ALREADY_EXISTS AIModelError = 1 - AIModelError_NOT_FOUND AIModelError = 2 - AIModelError_NOT_UPDATED AIModelError = 3 - AIModelError_NOT_AUTHORIZED AIModelError = 4 + AIModelError_NO_ERROR AIModelError = 0 + AIModelError_ALREADY_EXISTS AIModelError = 1 + AIModelError_NOT_FOUND AIModelError = 2 + AIModelError_NOT_UPDATED AIModelError = 3 + AIModelError_NOT_AUTHORIZED AIModelError = 4 + AIModelError_AIMODEL_OUT_OF_CREDITS AIModelError = 5 + AIModelError_AIMODEL_DONT_HANDLE_COMPLETION AIModelError = 6 ) // Enum value maps for AIModelError. @@ -39,13 +41,17 @@ var ( 2: "NOT_FOUND", 3: "NOT_UPDATED", 4: "NOT_AUTHORIZED", + 5: "AIMODEL_OUT_OF_CREDITS", + 6: "AIMODEL_DONT_HANDLE_COMPLETION", } AIModelError_value = map[string]int32{ - "NO_ERROR": 0, - "ALREADY_EXISTS": 1, - "NOT_FOUND": 2, - "NOT_UPDATED": 3, - "NOT_AUTHORIZED": 4, + "NO_ERROR": 0, + "ALREADY_EXISTS": 1, + "NOT_FOUND": 2, + "NOT_UPDATED": 3, + "NOT_AUTHORIZED": 4, + "AIMODEL_OUT_OF_CREDITS": 5, + "AIMODEL_DONT_HANDLE_COMPLETION": 6, } ) @@ -179,6 +185,93 @@ func (x *AIModel) GetNameAlias() string { return "" } +type CompletionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModelId *string `protobuf:"bytes,1,opt,name=model_id,json=modelId,proto3,oneof" json:"model_id,omitempty"` + Completions []string `protobuf:"bytes,2,rep,name=completions,proto3" json:"completions,omitempty"` + InputTokens *int32 `protobuf:"varint,3,opt,name=input_tokens,json=inputTokens,proto3,oneof" json:"input_tokens,omitempty"` + OutputTokens *int32 `protobuf:"varint,4,opt,name=output_tokens,json=outputTokens,proto3,oneof" json:"output_tokens,omitempty"` + ImageResolution *string `protobuf:"bytes,5,opt,name=image_resolution,json=imageResolution,proto3,oneof" json:"image_resolution,omitempty"` + ImageSteps *int32 `protobuf:"varint,6,opt,name=image_steps,json=imageSteps,proto3,oneof" json:"image_steps,omitempty"` +} + +func (x *CompletionResponse) Reset() { + *x = CompletionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_aimodel_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CompletionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompletionResponse) ProtoMessage() {} + +func (x *CompletionResponse) ProtoReflect() protoreflect.Message { + mi := &file_aimodel_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompletionResponse.ProtoReflect.Descriptor instead. +func (*CompletionResponse) Descriptor() ([]byte, []int) { + return file_aimodel_proto_rawDescGZIP(), []int{1} +} + +func (x *CompletionResponse) GetModelId() string { + if x != nil && x.ModelId != nil { + return *x.ModelId + } + return "" +} + +func (x *CompletionResponse) GetCompletions() []string { + if x != nil { + return x.Completions + } + return nil +} + +func (x *CompletionResponse) GetInputTokens() int32 { + if x != nil && x.InputTokens != nil { + return *x.InputTokens + } + return 0 +} + +func (x *CompletionResponse) GetOutputTokens() int32 { + if x != nil && x.OutputTokens != nil { + return *x.OutputTokens + } + return 0 +} + +func (x *CompletionResponse) GetImageResolution() string { + if x != nil && x.ImageResolution != nil { + return *x.ImageResolution + } + return "" +} + +func (x *CompletionResponse) GetImageSteps() int32 { + if x != nil && x.ImageSteps != nil { + return *x.ImageSteps + } + return 0 +} + type AIModelResponseError struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -193,7 +286,7 @@ type AIModelResponseError struct { func (x *AIModelResponseError) Reset() { *x = AIModelResponseError{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[1] + mi := &file_aimodel_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -206,7 +299,7 @@ func (x *AIModelResponseError) String() string { func (*AIModelResponseError) ProtoMessage() {} func (x *AIModelResponseError) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[1] + mi := &file_aimodel_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -219,7 +312,7 @@ func (x *AIModelResponseError) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelResponseError.ProtoReflect.Descriptor instead. func (*AIModelResponseError) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{1} + return file_aimodel_proto_rawDescGZIP(), []int{2} } func (x *AIModelResponseError) GetCode() AIModelError { @@ -262,7 +355,7 @@ type AIModelListRequest struct { func (x *AIModelListRequest) Reset() { *x = AIModelListRequest{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[2] + mi := &file_aimodel_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -275,7 +368,7 @@ func (x *AIModelListRequest) String() string { func (*AIModelListRequest) ProtoMessage() {} func (x *AIModelListRequest) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[2] + mi := &file_aimodel_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -288,7 +381,7 @@ func (x *AIModelListRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelListRequest.ProtoReflect.Descriptor instead. func (*AIModelListRequest) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{2} + return file_aimodel_proto_rawDescGZIP(), []int{3} } func (x *AIModelListRequest) GetPageSize() int32 { @@ -318,7 +411,7 @@ type AIModelListResponse struct { func (x *AIModelListResponse) Reset() { *x = AIModelListResponse{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[3] + mi := &file_aimodel_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -331,7 +424,7 @@ func (x *AIModelListResponse) String() string { func (*AIModelListResponse) ProtoMessage() {} func (x *AIModelListResponse) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[3] + mi := &file_aimodel_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -344,7 +437,7 @@ func (x *AIModelListResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelListResponse.ProtoReflect.Descriptor instead. func (*AIModelListResponse) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{3} + return file_aimodel_proto_rawDescGZIP(), []int{4} } func (x *AIModelListResponse) GetAimodels() []*AIModel { @@ -379,7 +472,7 @@ type AIModelGetRequest struct { func (x *AIModelGetRequest) Reset() { *x = AIModelGetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[4] + mi := &file_aimodel_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -392,7 +485,7 @@ func (x *AIModelGetRequest) String() string { func (*AIModelGetRequest) ProtoMessage() {} func (x *AIModelGetRequest) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[4] + mi := &file_aimodel_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -405,7 +498,7 @@ func (x *AIModelGetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelGetRequest.ProtoReflect.Descriptor instead. func (*AIModelGetRequest) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{4} + return file_aimodel_proto_rawDescGZIP(), []int{5} } func (x *AIModelGetRequest) GetId() string { @@ -427,7 +520,7 @@ type AIModelGetResponse struct { func (x *AIModelGetResponse) Reset() { *x = AIModelGetResponse{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[5] + mi := &file_aimodel_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -440,7 +533,7 @@ func (x *AIModelGetResponse) String() string { func (*AIModelGetResponse) ProtoMessage() {} func (x *AIModelGetResponse) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[5] + mi := &file_aimodel_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -453,7 +546,7 @@ func (x *AIModelGetResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelGetResponse.ProtoReflect.Descriptor instead. func (*AIModelGetResponse) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{5} + return file_aimodel_proto_rawDescGZIP(), []int{6} } func (x *AIModelGetResponse) GetAimodel() *AIModel { @@ -470,6 +563,116 @@ func (x *AIModelGetResponse) GetError() *AIModelResponseError { return nil } +type AIModelCompletionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` + Payload *string `protobuf:"bytes,2,opt,name=payload,proto3,oneof" json:"payload,omitempty"` +} + +func (x *AIModelCompletionRequest) Reset() { + *x = AIModelCompletionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_aimodel_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AIModelCompletionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AIModelCompletionRequest) ProtoMessage() {} + +func (x *AIModelCompletionRequest) ProtoReflect() protoreflect.Message { + mi := &file_aimodel_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AIModelCompletionRequest.ProtoReflect.Descriptor instead. +func (*AIModelCompletionRequest) Descriptor() ([]byte, []int) { + return file_aimodel_proto_rawDescGZIP(), []int{7} +} + +func (x *AIModelCompletionRequest) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *AIModelCompletionRequest) GetPayload() string { + if x != nil && x.Payload != nil { + return *x.Payload + } + return "" +} + +type AIModelCompletionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Completion *CompletionResponse `protobuf:"bytes,1,opt,name=completion,proto3,oneof" json:"completion,omitempty"` + Error *AIModelResponseError `protobuf:"bytes,2,opt,name=error,proto3,oneof" json:"error,omitempty"` +} + +func (x *AIModelCompletionResponse) Reset() { + *x = AIModelCompletionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_aimodel_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AIModelCompletionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AIModelCompletionResponse) ProtoMessage() {} + +func (x *AIModelCompletionResponse) ProtoReflect() protoreflect.Message { + mi := &file_aimodel_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AIModelCompletionResponse.ProtoReflect.Descriptor instead. +func (*AIModelCompletionResponse) Descriptor() ([]byte, []int) { + return file_aimodel_proto_rawDescGZIP(), []int{8} +} + +func (x *AIModelCompletionResponse) GetCompletion() *CompletionResponse { + if x != nil { + return x.Completion + } + return nil +} + +func (x *AIModelCompletionResponse) GetError() *AIModelResponseError { + if x != nil { + return x.Error + } + return nil +} + type AIModelAdminCreationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -487,7 +690,7 @@ type AIModelAdminCreationRequest struct { func (x *AIModelAdminCreationRequest) Reset() { *x = AIModelAdminCreationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[6] + mi := &file_aimodel_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -500,7 +703,7 @@ func (x *AIModelAdminCreationRequest) String() string { func (*AIModelAdminCreationRequest) ProtoMessage() {} func (x *AIModelAdminCreationRequest) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[6] + mi := &file_aimodel_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -513,7 +716,7 @@ func (x *AIModelAdminCreationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelAdminCreationRequest.ProtoReflect.Descriptor instead. func (*AIModelAdminCreationRequest) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{6} + return file_aimodel_proto_rawDescGZIP(), []int{9} } func (x *AIModelAdminCreationRequest) GetName() string { @@ -577,7 +780,7 @@ type AIModelAdminCreationResponse struct { func (x *AIModelAdminCreationResponse) Reset() { *x = AIModelAdminCreationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[7] + mi := &file_aimodel_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -590,7 +793,7 @@ func (x *AIModelAdminCreationResponse) String() string { func (*AIModelAdminCreationResponse) ProtoMessage() {} func (x *AIModelAdminCreationResponse) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[7] + mi := &file_aimodel_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -603,7 +806,7 @@ func (x *AIModelAdminCreationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelAdminCreationResponse.ProtoReflect.Descriptor instead. func (*AIModelAdminCreationResponse) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{7} + return file_aimodel_proto_rawDescGZIP(), []int{10} } func (x *AIModelAdminCreationResponse) GetAimodel() *AIModel { @@ -631,7 +834,7 @@ type AIModelAdminDeleteRequest struct { func (x *AIModelAdminDeleteRequest) Reset() { *x = AIModelAdminDeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[8] + mi := &file_aimodel_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -644,7 +847,7 @@ func (x *AIModelAdminDeleteRequest) String() string { func (*AIModelAdminDeleteRequest) ProtoMessage() {} func (x *AIModelAdminDeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[8] + mi := &file_aimodel_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -657,7 +860,7 @@ func (x *AIModelAdminDeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelAdminDeleteRequest.ProtoReflect.Descriptor instead. func (*AIModelAdminDeleteRequest) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{8} + return file_aimodel_proto_rawDescGZIP(), []int{11} } func (x *AIModelAdminDeleteRequest) GetId() string { @@ -678,7 +881,7 @@ type AIModelAdminDeleteResponse struct { func (x *AIModelAdminDeleteResponse) Reset() { *x = AIModelAdminDeleteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_aimodel_proto_msgTypes[9] + mi := &file_aimodel_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -691,7 +894,7 @@ func (x *AIModelAdminDeleteResponse) String() string { func (*AIModelAdminDeleteResponse) ProtoMessage() {} func (x *AIModelAdminDeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_aimodel_proto_msgTypes[9] + mi := &file_aimodel_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -704,7 +907,7 @@ func (x *AIModelAdminDeleteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AIModelAdminDeleteResponse.ProtoReflect.Descriptor instead. func (*AIModelAdminDeleteResponse) Descriptor() ([]byte, []int) { - return file_aimodel_proto_rawDescGZIP(), []int{9} + return file_aimodel_proto_rawDescGZIP(), []int{12} } func (x *AIModelAdminDeleteResponse) GetError() *AIModelResponseError { @@ -741,7 +944,29 @@ var file_aimodel_proto_rawDesc = []byte{ 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x61, 0x6c, - 0x69, 0x61, 0x73, 0x22, 0xca, 0x01, 0x0a, 0x14, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, + 0x69, 0x61, 0x73, 0x22, 0xdd, 0x02, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x08, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, + 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x49, + 0x64, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x0b, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x12, 0x28, + 0x0a, 0x0d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x0c, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x12, 0x2e, 0x0a, 0x10, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x03, 0x52, 0x0f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x6c, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x04, 0x52, + 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x53, 0x74, 0x65, 0x70, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0b, + 0x0a, 0x09, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x42, 0x10, 0x0a, 0x0e, + 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x42, 0x13, + 0x0a, 0x11, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x73, 0x22, 0xca, 0x01, 0x0a, 0x14, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2e, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x61, 0x69, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x45, 0x72, 0x72, 0x6f, @@ -787,6 +1012,24 @@ var file_aimodel_proto_rawDesc = []byte{ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x01, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x69, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, + 0x6b, 0x0a, 0x18, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0xb0, 0x01, + 0x01, 0x48, 0x00, 0x52, 0x02, 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f, 0x69, 0x64, + 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xb0, 0x01, 0x0a, + 0x19, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0a, 0x63, 0x6f, + 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x61, 0x69, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x63, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x38, 0x0a, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x69, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x01, 0x52, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xc6, 0x02, 0x0a, 0x1b, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, @@ -828,16 +1071,20 @@ var file_aimodel_proto_rawDesc = []byte{ 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2a, - 0x64, 0x0a, 0x0c, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, - 0x0c, 0x0a, 0x08, 0x4e, 0x4f, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x00, 0x12, 0x12, 0x0a, - 0x0e, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x10, - 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x02, - 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, - 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x4f, 0x54, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, 0x49, - 0x5a, 0x45, 0x44, 0x10, 0x04, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x70, 0x79, 0x74, 0x65, 0x72, 0x2d, 0x6e, 0x61, 0x61, 0x73, - 0x2f, 0x6e, 0x61, 0x61, 0x73, 0x2d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x67, 0x6f, 0x2f, - 0x61, 0x69, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0xa4, 0x01, 0x0a, 0x0c, 0x41, 0x49, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x4f, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x00, 0x12, 0x12, + 0x0a, 0x0e, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, + 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, + 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, + 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x4f, 0x54, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, + 0x49, 0x5a, 0x45, 0x44, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x49, 0x4d, 0x4f, 0x44, 0x45, + 0x4c, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x43, 0x52, 0x45, 0x44, 0x49, 0x54, 0x53, + 0x10, 0x05, 0x12, 0x22, 0x0a, 0x1e, 0x41, 0x49, 0x4d, 0x4f, 0x44, 0x45, 0x4c, 0x5f, 0x44, 0x4f, + 0x4e, 0x54, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, + 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x06, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x70, 0x79, 0x74, 0x65, 0x72, 0x2d, 0x6e, 0x61, 0x61, + 0x73, 0x2f, 0x6e, 0x61, 0x61, 0x73, 0x2d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x67, 0x6f, + 0x2f, 0x61, 0x69, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -853,34 +1100,39 @@ func file_aimodel_proto_rawDescGZIP() []byte { } var file_aimodel_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_aimodel_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_aimodel_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_aimodel_proto_goTypes = []interface{}{ (AIModelError)(0), // 0: aimodel.AIModelError (*AIModel)(nil), // 1: aimodel.AIModel - (*AIModelResponseError)(nil), // 2: aimodel.AIModelResponseError - (*AIModelListRequest)(nil), // 3: aimodel.AIModelListRequest - (*AIModelListResponse)(nil), // 4: aimodel.AIModelListResponse - (*AIModelGetRequest)(nil), // 5: aimodel.AIModelGetRequest - (*AIModelGetResponse)(nil), // 6: aimodel.AIModelGetResponse - (*AIModelAdminCreationRequest)(nil), // 7: aimodel.AIModelAdminCreationRequest - (*AIModelAdminCreationResponse)(nil), // 8: aimodel.AIModelAdminCreationResponse - (*AIModelAdminDeleteRequest)(nil), // 9: aimodel.AIModelAdminDeleteRequest - (*AIModelAdminDeleteResponse)(nil), // 10: aimodel.AIModelAdminDeleteResponse + (*CompletionResponse)(nil), // 2: aimodel.CompletionResponse + (*AIModelResponseError)(nil), // 3: aimodel.AIModelResponseError + (*AIModelListRequest)(nil), // 4: aimodel.AIModelListRequest + (*AIModelListResponse)(nil), // 5: aimodel.AIModelListResponse + (*AIModelGetRequest)(nil), // 6: aimodel.AIModelGetRequest + (*AIModelGetResponse)(nil), // 7: aimodel.AIModelGetResponse + (*AIModelCompletionRequest)(nil), // 8: aimodel.AIModelCompletionRequest + (*AIModelCompletionResponse)(nil), // 9: aimodel.AIModelCompletionResponse + (*AIModelAdminCreationRequest)(nil), // 10: aimodel.AIModelAdminCreationRequest + (*AIModelAdminCreationResponse)(nil), // 11: aimodel.AIModelAdminCreationResponse + (*AIModelAdminDeleteRequest)(nil), // 12: aimodel.AIModelAdminDeleteRequest + (*AIModelAdminDeleteResponse)(nil), // 13: aimodel.AIModelAdminDeleteResponse } var file_aimodel_proto_depIdxs = []int32{ - 0, // 0: aimodel.AIModelResponseError.code:type_name -> aimodel.AIModelError - 1, // 1: aimodel.AIModelListResponse.aimodels:type_name -> aimodel.AIModel - 2, // 2: aimodel.AIModelListResponse.error:type_name -> aimodel.AIModelResponseError - 1, // 3: aimodel.AIModelGetResponse.aimodel:type_name -> aimodel.AIModel - 2, // 4: aimodel.AIModelGetResponse.error:type_name -> aimodel.AIModelResponseError - 1, // 5: aimodel.AIModelAdminCreationResponse.aimodel:type_name -> aimodel.AIModel - 2, // 6: aimodel.AIModelAdminCreationResponse.error:type_name -> aimodel.AIModelResponseError - 2, // 7: aimodel.AIModelAdminDeleteResponse.error:type_name -> aimodel.AIModelResponseError - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 0, // 0: aimodel.AIModelResponseError.code:type_name -> aimodel.AIModelError + 1, // 1: aimodel.AIModelListResponse.aimodels:type_name -> aimodel.AIModel + 3, // 2: aimodel.AIModelListResponse.error:type_name -> aimodel.AIModelResponseError + 1, // 3: aimodel.AIModelGetResponse.aimodel:type_name -> aimodel.AIModel + 3, // 4: aimodel.AIModelGetResponse.error:type_name -> aimodel.AIModelResponseError + 2, // 5: aimodel.AIModelCompletionResponse.completion:type_name -> aimodel.CompletionResponse + 3, // 6: aimodel.AIModelCompletionResponse.error:type_name -> aimodel.AIModelResponseError + 1, // 7: aimodel.AIModelAdminCreationResponse.aimodel:type_name -> aimodel.AIModel + 3, // 8: aimodel.AIModelAdminCreationResponse.error:type_name -> aimodel.AIModelResponseError + 3, // 9: aimodel.AIModelAdminDeleteResponse.error:type_name -> aimodel.AIModelResponseError + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_aimodel_proto_init() } @@ -902,7 +1154,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelResponseError); i { + switch v := v.(*CompletionResponse); i { case 0: return &v.state case 1: @@ -914,7 +1166,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelListRequest); i { + switch v := v.(*AIModelResponseError); i { case 0: return &v.state case 1: @@ -926,7 +1178,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelListResponse); i { + switch v := v.(*AIModelListRequest); i { case 0: return &v.state case 1: @@ -938,7 +1190,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelGetRequest); i { + switch v := v.(*AIModelListResponse); i { case 0: return &v.state case 1: @@ -950,7 +1202,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelGetResponse); i { + switch v := v.(*AIModelGetRequest); i { case 0: return &v.state case 1: @@ -962,7 +1214,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelAdminCreationRequest); i { + switch v := v.(*AIModelGetResponse); i { case 0: return &v.state case 1: @@ -974,7 +1226,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelAdminCreationResponse); i { + switch v := v.(*AIModelCompletionRequest); i { case 0: return &v.state case 1: @@ -986,7 +1238,7 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AIModelAdminDeleteRequest); i { + switch v := v.(*AIModelCompletionResponse); i { case 0: return &v.state case 1: @@ -998,6 +1250,42 @@ func file_aimodel_proto_init() { } } file_aimodel_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AIModelAdminCreationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aimodel_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AIModelAdminCreationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aimodel_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AIModelAdminDeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_aimodel_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AIModelAdminDeleteResponse); i { case 0: return &v.state @@ -1020,13 +1308,16 @@ func file_aimodel_proto_init() { file_aimodel_proto_msgTypes[7].OneofWrappers = []interface{}{} file_aimodel_proto_msgTypes[8].OneofWrappers = []interface{}{} file_aimodel_proto_msgTypes[9].OneofWrappers = []interface{}{} + file_aimodel_proto_msgTypes[10].OneofWrappers = []interface{}{} + file_aimodel_proto_msgTypes[11].OneofWrappers = []interface{}{} + file_aimodel_proto_msgTypes[12].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_aimodel_proto_rawDesc, NumEnums: 1, - NumMessages: 10, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.validate.go b/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.validate.go index 2d6743d..0d14b59 100644 --- a/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.validate.go +++ b/go/github.com/jupyter-naas/naas-models/go/aimodel/aimodel.pb.validate.go @@ -188,6 +188,148 @@ var _ interface { ErrorName() string } = AIModelValidationError{} +// Validate checks the field values on CompletionResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CompletionResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CompletionResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CompletionResponseMultiError, or nil if none found. +func (m *CompletionResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *CompletionResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.ModelId != nil { + + if err := m._validateUuid(m.GetModelId()); err != nil { + err = CompletionResponseValidationError{ + field: "ModelId", + reason: "value must be a valid UUID", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.InputTokens != nil { + // no validation rules for InputTokens + } + + if m.OutputTokens != nil { + // no validation rules for OutputTokens + } + + if m.ImageResolution != nil { + // no validation rules for ImageResolution + } + + if m.ImageSteps != nil { + // no validation rules for ImageSteps + } + + if len(errors) > 0 { + return CompletionResponseMultiError(errors) + } + + return nil +} + +func (m *CompletionResponse) _validateUuid(uuid string) error { + if matched := _aimodel_uuidPattern.MatchString(uuid); !matched { + return errors.New("invalid uuid format") + } + + return nil +} + +// CompletionResponseMultiError is an error wrapping multiple validation errors +// returned by CompletionResponse.ValidateAll() if the designated constraints +// aren't met. +type CompletionResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CompletionResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CompletionResponseMultiError) AllErrors() []error { return m } + +// CompletionResponseValidationError is the validation error returned by +// CompletionResponse.Validate if the designated constraints aren't met. +type CompletionResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CompletionResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CompletionResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CompletionResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CompletionResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CompletionResponseValidationError) ErrorName() string { + return "CompletionResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e CompletionResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCompletionResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CompletionResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CompletionResponseValidationError{} + // Validate checks the field values on AIModelResponseError with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. @@ -883,6 +1025,304 @@ var _ interface { ErrorName() string } = AIModelGetResponseValidationError{} +// Validate checks the field values on AIModelCompletionRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *AIModelCompletionRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AIModelCompletionRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// AIModelCompletionRequestMultiError, or nil if none found. +func (m *AIModelCompletionRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *AIModelCompletionRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.Id != nil { + + if err := m._validateUuid(m.GetId()); err != nil { + err = AIModelCompletionRequestValidationError{ + field: "Id", + reason: "value must be a valid UUID", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.Payload != nil { + // no validation rules for Payload + } + + if len(errors) > 0 { + return AIModelCompletionRequestMultiError(errors) + } + + return nil +} + +func (m *AIModelCompletionRequest) _validateUuid(uuid string) error { + if matched := _aimodel_uuidPattern.MatchString(uuid); !matched { + return errors.New("invalid uuid format") + } + + return nil +} + +// AIModelCompletionRequestMultiError is an error wrapping multiple validation +// errors returned by AIModelCompletionRequest.ValidateAll() if the designated +// constraints aren't met. +type AIModelCompletionRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AIModelCompletionRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AIModelCompletionRequestMultiError) AllErrors() []error { return m } + +// AIModelCompletionRequestValidationError is the validation error returned by +// AIModelCompletionRequest.Validate if the designated constraints aren't met. +type AIModelCompletionRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AIModelCompletionRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AIModelCompletionRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AIModelCompletionRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AIModelCompletionRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AIModelCompletionRequestValidationError) ErrorName() string { + return "AIModelCompletionRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e AIModelCompletionRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAIModelCompletionRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AIModelCompletionRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AIModelCompletionRequestValidationError{} + +// Validate checks the field values on AIModelCompletionResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *AIModelCompletionResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AIModelCompletionResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// AIModelCompletionResponseMultiError, or nil if none found. +func (m *AIModelCompletionResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *AIModelCompletionResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.Completion != nil { + + if all { + switch v := interface{}(m.GetCompletion()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AIModelCompletionResponseValidationError{ + field: "Completion", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AIModelCompletionResponseValidationError{ + field: "Completion", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCompletion()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AIModelCompletionResponseValidationError{ + field: "Completion", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if m.Error != nil { + + if all { + switch v := interface{}(m.GetError()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AIModelCompletionResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AIModelCompletionResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AIModelCompletionResponseValidationError{ + field: "Error", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return AIModelCompletionResponseMultiError(errors) + } + + return nil +} + +// AIModelCompletionResponseMultiError is an error wrapping multiple validation +// errors returned by AIModelCompletionResponse.ValidateAll() if the +// designated constraints aren't met. +type AIModelCompletionResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AIModelCompletionResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AIModelCompletionResponseMultiError) AllErrors() []error { return m } + +// AIModelCompletionResponseValidationError is the validation error returned by +// AIModelCompletionResponse.Validate if the designated constraints aren't met. +type AIModelCompletionResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AIModelCompletionResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AIModelCompletionResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AIModelCompletionResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AIModelCompletionResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AIModelCompletionResponseValidationError) ErrorName() string { + return "AIModelCompletionResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e AIModelCompletionResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAIModelCompletionResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AIModelCompletionResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AIModelCompletionResponseValidationError{} + // Validate checks the field values on AIModelAdminCreationRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. diff --git a/protos/aimodel.proto b/protos/aimodel.proto index a576489..fdee20a 100644 --- a/protos/aimodel.proto +++ b/protos/aimodel.proto @@ -17,6 +17,15 @@ message AIModel { optional string name_alias = 8; } +message CompletionResponse { + optional string model_id = 1 [(validate.rules).string.uuid = true]; + repeated string completions = 2; + optional int32 input_tokens = 3; + optional int32 output_tokens = 4; + optional string image_resolution = 5; + optional int32 image_steps = 6; +} + /** * Errors */ @@ -27,6 +36,8 @@ enum AIModelError { NOT_FOUND = 2; NOT_UPDATED = 3; NOT_AUTHORIZED = 4; + AIMODEL_OUT_OF_CREDITS = 5; + AIMODEL_DONT_HANDLE_COMPLETION = 6; } message AIModelResponseError { @@ -67,6 +78,17 @@ message AIModelGetResponse { optional AIModelResponseError error = 2; } +message AIModelCompletionRequest { + optional string id = 1 [(validate.rules).string.uuid = true]; + optional string payload = 2; +} + +message AIModelCompletionResponse { + optional CompletionResponse completion = 1; + optional AIModelResponseError error = 2; +} + + // ADMINISTRATOR SPACE // Users are not able to create models. @@ -100,4 +122,5 @@ message AIModelAdminDeleteRequest { message AIModelAdminDeleteResponse { optional AIModelResponseError error = 2; -} \ No newline at end of file +} + diff --git a/python/naas_models/aimodel_pb2.py b/python/naas_models/aimodel_pb2.py index 7c0ca3c..8cf99d0 100644 --- a/python/naas_models/aimodel_pb2.py +++ b/python/naas_models/aimodel_pb2.py @@ -16,7 +16,7 @@ import naas_models.validate_pb2 as validate__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\raimodel.proto\x12\x07\x61imodel\x1a\x0evalidate.proto\"\x97\x02\n\x07\x41IModel\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08provider\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x12\n\x05image\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x14\n\x07\x65nabled\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x11\n\x04type\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x17\n\nrestricted\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x17\n\nname_alias\x18\x08 \x01(\tH\x07\x88\x01\x01\x42\x05\n\x03_idB\x07\n\x05_nameB\x0b\n\t_providerB\x08\n\x06_imageB\n\n\x08_enabledB\x07\n\x05_typeB\r\n\x0b_restrictedB\r\n\x0b_name_alias\"\xab\x01\n\x14\x41IModelResponseError\x12(\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x15.aimodel.AIModelErrorH\x00\x88\x01\x01\x12\x13\n\x06status\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06reason\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07message\x18\x04 \x01(\tH\x03\x88\x01\x01\x42\x07\n\x05_codeB\t\n\x07_statusB\t\n\x07_reasonB\n\n\x08_message\"d\n\x12\x41IModelListRequest\x12\x16\n\tpage_size\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x18\n\x0bpage_number\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0c\n\n_page_sizeB\x0e\n\x0c_page_number\"\xa0\x01\n\x13\x41IModelListResponse\x12\"\n\x08\x61imodels\x18\x01 \x03(\x0b\x32\x10.aimodel.AIModel\x12\x18\n\x0bpage_number\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\x0e\n\x0c_page_numberB\x08\n\x06_error\"5\n\x11\x41IModelGetRequest\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x42\x05\n\x03_id\"\x85\x01\n\x12\x41IModelGetResponse\x12&\n\x07\x61imodel\x18\x01 \x01(\x0b\x32\x10.aimodel.AIModelH\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\n\n\x08_aimodelB\x08\n\x06_error\"\x89\x02\n\x1b\x41IModelAdminCreationRequest\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08provider\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05image\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07\x65nabled\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x11\n\x04type\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x17\n\nrestricted\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x17\n\nname_alias\x18\x07 \x01(\tH\x06\x88\x01\x01\x42\x07\n\x05_nameB\x0b\n\t_providerB\x08\n\x06_imageB\n\n\x08_enabledB\x07\n\x05_typeB\r\n\x0b_restrictedB\r\n\x0b_name_alias\"\x8f\x01\n\x1c\x41IModelAdminCreationResponse\x12&\n\x07\x61imodel\x18\x01 \x01(\x0b\x32\x10.aimodel.AIModelH\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\n\n\x08_aimodelB\x08\n\x06_error\"=\n\x19\x41IModelAdminDeleteRequest\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x42\x05\n\x03_id\"Y\n\x1a\x41IModelAdminDeleteResponse\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x00\x88\x01\x01\x42\x08\n\x06_error*d\n\x0c\x41IModelError\x12\x0c\n\x08NO_ERROR\x10\x00\x12\x12\n\x0e\x41LREADY_EXISTS\x10\x01\x12\r\n\tNOT_FOUND\x10\x02\x12\x0f\n\x0bNOT_UPDATED\x10\x03\x12\x12\n\x0eNOT_AUTHORIZED\x10\x04\x42\x30Z.github.com/jupyter-naas/naas-models/go/aimodelb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\raimodel.proto\x12\x07\x61imodel\x1a\x0evalidate.proto\"\x97\x02\n\x07\x41IModel\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08provider\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x12\n\x05image\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x14\n\x07\x65nabled\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x11\n\x04type\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x17\n\nrestricted\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x17\n\nname_alias\x18\x08 \x01(\tH\x07\x88\x01\x01\x42\x05\n\x03_idB\x07\n\x05_nameB\x0b\n\t_providerB\x08\n\x06_imageB\n\n\x08_enabledB\x07\n\x05_typeB\r\n\x0b_restrictedB\r\n\x0b_name_alias\"\x8f\x02\n\x12\x43ompletionResponse\x12\x1f\n\x08model_id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x12\x13\n\x0b\x63ompletions\x18\x02 \x03(\t\x12\x19\n\x0cinput_tokens\x18\x03 \x01(\x05H\x01\x88\x01\x01\x12\x1a\n\routput_tokens\x18\x04 \x01(\x05H\x02\x88\x01\x01\x12\x1d\n\x10image_resolution\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\x18\n\x0bimage_steps\x18\x06 \x01(\x05H\x04\x88\x01\x01\x42\x0b\n\t_model_idB\x0f\n\r_input_tokensB\x10\n\x0e_output_tokensB\x13\n\x11_image_resolutionB\x0e\n\x0c_image_steps\"\xab\x01\n\x14\x41IModelResponseError\x12(\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x15.aimodel.AIModelErrorH\x00\x88\x01\x01\x12\x13\n\x06status\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06reason\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07message\x18\x04 \x01(\tH\x03\x88\x01\x01\x42\x07\n\x05_codeB\t\n\x07_statusB\t\n\x07_reasonB\n\n\x08_message\"d\n\x12\x41IModelListRequest\x12\x16\n\tpage_size\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x18\n\x0bpage_number\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0c\n\n_page_sizeB\x0e\n\x0c_page_number\"\xa0\x01\n\x13\x41IModelListResponse\x12\"\n\x08\x61imodels\x18\x01 \x03(\x0b\x32\x10.aimodel.AIModel\x12\x18\n\x0bpage_number\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\x0e\n\x0c_page_numberB\x08\n\x06_error\"5\n\x11\x41IModelGetRequest\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x42\x05\n\x03_id\"\x85\x01\n\x12\x41IModelGetResponse\x12&\n\x07\x61imodel\x18\x01 \x01(\x0b\x32\x10.aimodel.AIModelH\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\n\n\x08_aimodelB\x08\n\x06_error\"^\n\x18\x41IModelCompletionRequest\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x12\x14\n\x07payload\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x05\n\x03_idB\n\n\x08_payload\"\x9d\x01\n\x19\x41IModelCompletionResponse\x12\x34\n\ncompletion\x18\x01 \x01(\x0b\x32\x1b.aimodel.CompletionResponseH\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\r\n\x0b_completionB\x08\n\x06_error\"\x89\x02\n\x1b\x41IModelAdminCreationRequest\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08provider\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05image\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x14\n\x07\x65nabled\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x11\n\x04type\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x17\n\nrestricted\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x17\n\nname_alias\x18\x07 \x01(\tH\x06\x88\x01\x01\x42\x07\n\x05_nameB\x0b\n\t_providerB\x08\n\x06_imageB\n\n\x08_enabledB\x07\n\x05_typeB\r\n\x0b_restrictedB\r\n\x0b_name_alias\"\x8f\x01\n\x1c\x41IModelAdminCreationResponse\x12&\n\x07\x61imodel\x18\x01 \x01(\x0b\x32\x10.aimodel.AIModelH\x00\x88\x01\x01\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x01\x88\x01\x01\x42\n\n\x08_aimodelB\x08\n\x06_error\"=\n\x19\x41IModelAdminDeleteRequest\x12\x19\n\x02id\x18\x01 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01H\x00\x88\x01\x01\x42\x05\n\x03_id\"Y\n\x1a\x41IModelAdminDeleteResponse\x12\x31\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.aimodel.AIModelResponseErrorH\x00\x88\x01\x01\x42\x08\n\x06_error*\xa4\x01\n\x0c\x41IModelError\x12\x0c\n\x08NO_ERROR\x10\x00\x12\x12\n\x0e\x41LREADY_EXISTS\x10\x01\x12\r\n\tNOT_FOUND\x10\x02\x12\x0f\n\x0bNOT_UPDATED\x10\x03\x12\x12\n\x0eNOT_AUTHORIZED\x10\x04\x12\x1a\n\x16\x41IMODEL_OUT_OF_CREDITS\x10\x05\x12\"\n\x1e\x41IMODEL_DONT_HANDLE_COMPLETION\x10\x06\x42\x30Z.github.com/jupyter-naas/naas-models/go/aimodelb\x06proto3') _AIMODELERROR = DESCRIPTOR.enum_types_by_name['AIModelError'] AIModelError = enum_type_wrapper.EnumTypeWrapper(_AIMODELERROR) @@ -25,14 +25,19 @@ NOT_FOUND = 2 NOT_UPDATED = 3 NOT_AUTHORIZED = 4 +AIMODEL_OUT_OF_CREDITS = 5 +AIMODEL_DONT_HANDLE_COMPLETION = 6 _AIMODEL = DESCRIPTOR.message_types_by_name['AIModel'] +_COMPLETIONRESPONSE = DESCRIPTOR.message_types_by_name['CompletionResponse'] _AIMODELRESPONSEERROR = DESCRIPTOR.message_types_by_name['AIModelResponseError'] _AIMODELLISTREQUEST = DESCRIPTOR.message_types_by_name['AIModelListRequest'] _AIMODELLISTRESPONSE = DESCRIPTOR.message_types_by_name['AIModelListResponse'] _AIMODELGETREQUEST = DESCRIPTOR.message_types_by_name['AIModelGetRequest'] _AIMODELGETRESPONSE = DESCRIPTOR.message_types_by_name['AIModelGetResponse'] +_AIMODELCOMPLETIONREQUEST = DESCRIPTOR.message_types_by_name['AIModelCompletionRequest'] +_AIMODELCOMPLETIONRESPONSE = DESCRIPTOR.message_types_by_name['AIModelCompletionResponse'] _AIMODELADMINCREATIONREQUEST = DESCRIPTOR.message_types_by_name['AIModelAdminCreationRequest'] _AIMODELADMINCREATIONRESPONSE = DESCRIPTOR.message_types_by_name['AIModelAdminCreationResponse'] _AIMODELADMINDELETEREQUEST = DESCRIPTOR.message_types_by_name['AIModelAdminDeleteRequest'] @@ -44,6 +49,13 @@ }) _sym_db.RegisterMessage(AIModel) +CompletionResponse = _reflection.GeneratedProtocolMessageType('CompletionResponse', (_message.Message,), { + 'DESCRIPTOR' : _COMPLETIONRESPONSE, + '__module__' : 'aimodel_pb2' + # @@protoc_insertion_point(class_scope:aimodel.CompletionResponse) + }) +_sym_db.RegisterMessage(CompletionResponse) + AIModelResponseError = _reflection.GeneratedProtocolMessageType('AIModelResponseError', (_message.Message,), { 'DESCRIPTOR' : _AIMODELRESPONSEERROR, '__module__' : 'aimodel_pb2' @@ -79,6 +91,20 @@ }) _sym_db.RegisterMessage(AIModelGetResponse) +AIModelCompletionRequest = _reflection.GeneratedProtocolMessageType('AIModelCompletionRequest', (_message.Message,), { + 'DESCRIPTOR' : _AIMODELCOMPLETIONREQUEST, + '__module__' : 'aimodel_pb2' + # @@protoc_insertion_point(class_scope:aimodel.AIModelCompletionRequest) + }) +_sym_db.RegisterMessage(AIModelCompletionRequest) + +AIModelCompletionResponse = _reflection.GeneratedProtocolMessageType('AIModelCompletionResponse', (_message.Message,), { + 'DESCRIPTOR' : _AIMODELCOMPLETIONRESPONSE, + '__module__' : 'aimodel_pb2' + # @@protoc_insertion_point(class_scope:aimodel.AIModelCompletionResponse) + }) +_sym_db.RegisterMessage(AIModelCompletionResponse) + AIModelAdminCreationRequest = _reflection.GeneratedProtocolMessageType('AIModelAdminCreationRequest', (_message.Message,), { 'DESCRIPTOR' : _AIMODELADMINCREATIONREQUEST, '__module__' : 'aimodel_pb2' @@ -113,30 +139,40 @@ DESCRIPTOR._serialized_options = b'Z.github.com/jupyter-naas/naas-models/go/aimodel' _AIMODEL.fields_by_name['id']._options = None _AIMODEL.fields_by_name['id']._serialized_options = b'\372B\005r\003\260\001\001' + _COMPLETIONRESPONSE.fields_by_name['model_id']._options = None + _COMPLETIONRESPONSE.fields_by_name['model_id']._serialized_options = b'\372B\005r\003\260\001\001' _AIMODELGETREQUEST.fields_by_name['id']._options = None _AIMODELGETREQUEST.fields_by_name['id']._serialized_options = b'\372B\005r\003\260\001\001' + _AIMODELCOMPLETIONREQUEST.fields_by_name['id']._options = None + _AIMODELCOMPLETIONREQUEST.fields_by_name['id']._serialized_options = b'\372B\005r\003\260\001\001' _AIMODELADMINDELETEREQUEST.fields_by_name['id']._options = None _AIMODELADMINDELETEREQUEST.fields_by_name['id']._serialized_options = b'\372B\005r\003\260\001\001' - _AIMODELERROR._serialized_start=1522 - _AIMODELERROR._serialized_end=1622 + _AIMODELERROR._serialized_start=2053 + _AIMODELERROR._serialized_end=2217 _AIMODEL._serialized_start=43 _AIMODEL._serialized_end=322 - _AIMODELRESPONSEERROR._serialized_start=325 - _AIMODELRESPONSEERROR._serialized_end=496 - _AIMODELLISTREQUEST._serialized_start=498 - _AIMODELLISTREQUEST._serialized_end=598 - _AIMODELLISTRESPONSE._serialized_start=601 - _AIMODELLISTRESPONSE._serialized_end=761 - _AIMODELGETREQUEST._serialized_start=763 - _AIMODELGETREQUEST._serialized_end=816 - _AIMODELGETRESPONSE._serialized_start=819 - _AIMODELGETRESPONSE._serialized_end=952 - _AIMODELADMINCREATIONREQUEST._serialized_start=955 - _AIMODELADMINCREATIONREQUEST._serialized_end=1220 - _AIMODELADMINCREATIONRESPONSE._serialized_start=1223 - _AIMODELADMINCREATIONRESPONSE._serialized_end=1366 - _AIMODELADMINDELETEREQUEST._serialized_start=1368 - _AIMODELADMINDELETEREQUEST._serialized_end=1429 - _AIMODELADMINDELETERESPONSE._serialized_start=1431 - _AIMODELADMINDELETERESPONSE._serialized_end=1520 + _COMPLETIONRESPONSE._serialized_start=325 + _COMPLETIONRESPONSE._serialized_end=596 + _AIMODELRESPONSEERROR._serialized_start=599 + _AIMODELRESPONSEERROR._serialized_end=770 + _AIMODELLISTREQUEST._serialized_start=772 + _AIMODELLISTREQUEST._serialized_end=872 + _AIMODELLISTRESPONSE._serialized_start=875 + _AIMODELLISTRESPONSE._serialized_end=1035 + _AIMODELGETREQUEST._serialized_start=1037 + _AIMODELGETREQUEST._serialized_end=1090 + _AIMODELGETRESPONSE._serialized_start=1093 + _AIMODELGETRESPONSE._serialized_end=1226 + _AIMODELCOMPLETIONREQUEST._serialized_start=1228 + _AIMODELCOMPLETIONREQUEST._serialized_end=1322 + _AIMODELCOMPLETIONRESPONSE._serialized_start=1325 + _AIMODELCOMPLETIONRESPONSE._serialized_end=1482 + _AIMODELADMINCREATIONREQUEST._serialized_start=1485 + _AIMODELADMINCREATIONREQUEST._serialized_end=1750 + _AIMODELADMINCREATIONRESPONSE._serialized_start=1753 + _AIMODELADMINCREATIONRESPONSE._serialized_end=1896 + _AIMODELADMINDELETEREQUEST._serialized_start=1898 + _AIMODELADMINDELETEREQUEST._serialized_end=1959 + _AIMODELADMINDELETERESPONSE._serialized_start=1961 + _AIMODELADMINDELETERESPONSE._serialized_end=2050 # @@protoc_insertion_point(module_scope) diff --git a/python/naas_models/pydantic/aimodel_p2p.py b/python/naas_models/pydantic/aimodel_p2p.py index 00e0bb7..85f9610 100644 --- a/python/naas_models/pydantic/aimodel_p2p.py +++ b/python/naas_models/pydantic/aimodel_p2p.py @@ -19,6 +19,8 @@ class AIModelError(IntEnum): NOT_FOUND = 2 NOT_UPDATED = 3 NOT_AUTHORIZED = 4 + AIMODEL_OUT_OF_CREDITS = 5 + AIMODEL_DONT_HANDLE_COMPLETION = 6 @@ -40,6 +42,21 @@ class AIModel(BaseModel): +class CompletionResponse(BaseModel): + + _one_of_dict = {"CompletionResponse._image_resolution": {"fields": {"image_resolution"}}, "CompletionResponse._image_steps": {"fields": {"image_steps"}}, "CompletionResponse._input_tokens": {"fields": {"input_tokens"}}, "CompletionResponse._model_id": {"fields": {"model_id"}}, "CompletionResponse._output_tokens": {"fields": {"output_tokens"}}} + _check_one_of = root_validator(pre=True, allow_reuse=True)(check_one_of) + + model_id: UUID = FieldInfo(default="") + completions: typing.List[str] = FieldInfo(default_factory=list) + input_tokens: int = FieldInfo(default=0) + output_tokens: int = FieldInfo(default=0) + image_resolution: str = FieldInfo(default="") + image_steps: int = FieldInfo(default=0) + + + + class AIModelResponseError(BaseModel): _one_of_dict = {"AIModelResponseError._code": {"fields": {"code"}}, "AIModelResponseError._message": {"fields": {"message"}}, "AIModelResponseError._reason": {"fields": {"reason"}}, "AIModelResponseError._status": {"fields": {"status"}}} @@ -97,6 +114,28 @@ class AIModelGetResponse(BaseModel): +class AIModelCompletionRequest(BaseModel): + + _one_of_dict = {"AIModelCompletionRequest._id": {"fields": {"id"}}, "AIModelCompletionRequest._payload": {"fields": {"payload"}}} + _check_one_of = root_validator(pre=True, allow_reuse=True)(check_one_of) + + id: UUID = FieldInfo(default="") + payload: str = FieldInfo(default="") + + + + +class AIModelCompletionResponse(BaseModel): + + _one_of_dict = {"AIModelCompletionResponse._completion": {"fields": {"completion"}}, "AIModelCompletionResponse._error": {"fields": {"error"}}} + _check_one_of = root_validator(pre=True, allow_reuse=True)(check_one_of) + + completion: CompletionResponse = FieldInfo() + error: AIModelResponseError = FieldInfo() + + + + class AIModelAdminCreationRequest(BaseModel): _one_of_dict = {"AIModelAdminCreationRequest._enabled": {"fields": {"enabled"}}, "AIModelAdminCreationRequest._image": {"fields": {"image"}}, "AIModelAdminCreationRequest._name": {"fields": {"name"}}, "AIModelAdminCreationRequest._name_alias": {"fields": {"name_alias"}}, "AIModelAdminCreationRequest._provider": {"fields": {"provider"}}, "AIModelAdminCreationRequest._restricted": {"fields": {"restricted"}}, "AIModelAdminCreationRequest._type": {"fields": {"type"}}}