From d202602ea959c2232cf451a5a21f2a22cc4f0a3b Mon Sep 17 00:00:00 2001 From: matteo-grella Date: Mon, 30 Oct 2023 19:11:18 +0100 Subject: [PATCH] Update generated files --- .../v1/languagemodeling.swagger.json | 140 ++++++ .../v1/questionanswering.swagger.json | 149 ++++++ .../v1/textclassification.swagger.json | 108 +++++ .../textencoding/v1/textencoding.swagger.json | 106 +++++ .../v1/texgeneration.swagger.json | 131 ++++++ .../v1/tokenclassification.swagger.json | 137 ++++++ .../zeroshot/v1/zeroshot.swagger.json | 129 +++++ .../v1/languagemodeling.pb.go | 397 ++++++++++++++++ .../v1/languagemodeling.pb.gw.go | 171 +++++++ .../v1/languagemodeling_grpc.pb.go | 110 +++++ .../v1/questionanswering.pb.go | 445 ++++++++++++++++++ .../v1/questionanswering.pb.gw.go | 171 +++++++ .../v1/questionanswering_grpc.pb.go | 110 +++++ .../v1/textclassification.pb.go | 236 ++++++++++ .../v1/textclassification.pb.gw.go | 171 +++++++ .../v1/textclassification_grpc.pb.go | 110 +++++ .../go/textencoding/v1/textencoding.pb.go | 234 +++++++++ .../go/textencoding/v1/textencoding.pb.gw.go | 171 +++++++ .../textencoding/v1/textencoding_grpc.pb.go | 109 +++++ .../go/textgeneration/v1/texgeneration.pb.go | 348 ++++++++++++++ .../textgeneration/v1/texgeneration.pb.gw.go | 171 +++++++ .../v1/texgeneration_grpc.pb.go | 109 +++++ .../v1/tokenclassification.pb.go | 399 ++++++++++++++++ .../v1/tokenclassification.pb.gw.go | 171 +++++++ .../v1/tokenclassification_grpc.pb.go | 110 +++++ .../gen/proto/go/zeroshot/v1/zeroshot.pb.go | 330 +++++++++++++ .../proto/go/zeroshot/v1/zeroshot.pb.gw.go | 171 +++++++ .../proto/go/zeroshot/v1/zeroshot_grpc.pb.go | 109 +++++ 28 files changed, 5253 insertions(+) create mode 100644 pkg/server/gen/openapiv2/languagemodeling/v1/languagemodeling.swagger.json create mode 100644 pkg/server/gen/openapiv2/questionanswering/v1/questionanswering.swagger.json create mode 100644 pkg/server/gen/openapiv2/textclassification/v1/textclassification.swagger.json create mode 100644 pkg/server/gen/openapiv2/textencoding/v1/textencoding.swagger.json create mode 100644 pkg/server/gen/openapiv2/textgeneration/v1/texgeneration.swagger.json create mode 100644 pkg/server/gen/openapiv2/tokenclassification/v1/tokenclassification.swagger.json create mode 100644 pkg/server/gen/openapiv2/zeroshot/v1/zeroshot.swagger.json create mode 100644 pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.go create mode 100644 pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.gw.go create mode 100644 pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling_grpc.pb.go create mode 100644 pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.go create mode 100644 pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.gw.go create mode 100644 pkg/server/gen/proto/go/questionanswering/v1/questionanswering_grpc.pb.go create mode 100644 pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.go create mode 100644 pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.gw.go create mode 100644 pkg/server/gen/proto/go/textclassification/v1/textclassification_grpc.pb.go create mode 100644 pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.go create mode 100644 pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.gw.go create mode 100644 pkg/server/gen/proto/go/textencoding/v1/textencoding_grpc.pb.go create mode 100644 pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.go create mode 100644 pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.gw.go create mode 100644 pkg/server/gen/proto/go/textgeneration/v1/texgeneration_grpc.pb.go create mode 100644 pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.go create mode 100644 pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.gw.go create mode 100644 pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification_grpc.pb.go create mode 100644 pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.go create mode 100644 pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.gw.go create mode 100644 pkg/server/gen/proto/go/zeroshot/v1/zeroshot_grpc.pb.go diff --git a/pkg/server/gen/openapiv2/languagemodeling/v1/languagemodeling.swagger.json b/pkg/server/gen/openapiv2/languagemodeling/v1/languagemodeling.swagger.json new file mode 100644 index 0000000..f3aec55 --- /dev/null +++ b/pkg/server/gen/openapiv2/languagemodeling/v1/languagemodeling.swagger.json @@ -0,0 +1,140 @@ +{ + "swagger": "2.0", + "info": { + "title": "languagemodeling/v1/languagemodeling.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "LanguageModelingService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/predict": { + "post": { + "operationId": "LanguageModelingService_Predict", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1LanguageModelingResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1LanguageModelingRequest" + } + } + ], + "tags": [ + "LanguageModelingService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1LanguageModelingParameters": { + "type": "object", + "properties": { + "k": { + "type": "integer", + "format": "int32" + } + } + }, + "v1LanguageModelingRequest": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "parameters": { + "$ref": "#/definitions/v1LanguageModelingParameters" + } + } + }, + "v1LanguageModelingResponse": { + "type": "object", + "properties": { + "tokens": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Token" + } + } + } + }, + "v1Token": { + "type": "object", + "properties": { + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "words": { + "type": "array", + "items": { + "type": "string" + } + }, + "scores": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + } + } + } + } +} diff --git a/pkg/server/gen/openapiv2/questionanswering/v1/questionanswering.swagger.json b/pkg/server/gen/openapiv2/questionanswering/v1/questionanswering.swagger.json new file mode 100644 index 0000000..fc29062 --- /dev/null +++ b/pkg/server/gen/openapiv2/questionanswering/v1/questionanswering.swagger.json @@ -0,0 +1,149 @@ +{ + "swagger": "2.0", + "info": { + "title": "questionanswering/v1/questionanswering.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "QuestionAnsweringService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/answer": { + "post": { + "operationId": "QuestionAnsweringService_Answer", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1AnswerResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1AnswerRequest" + } + } + ], + "tags": [ + "QuestionAnsweringService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1Answer": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "start": { + "type": "string", + "format": "int64" + }, + "end": { + "type": "string", + "format": "int64" + }, + "score": { + "type": "number", + "format": "double" + } + } + }, + "v1AnswerRequest": { + "type": "object", + "properties": { + "question": { + "type": "string" + }, + "passage": { + "type": "string" + }, + "options": { + "$ref": "#/definitions/v1QuestionAnsweringOptions" + } + } + }, + "v1AnswerResponse": { + "type": "object", + "properties": { + "answers": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Answer" + } + } + } + }, + "v1QuestionAnsweringOptions": { + "type": "object", + "properties": { + "maxAnswers": { + "type": "string", + "format": "int64" + }, + "maxAnswersLen": { + "type": "string", + "format": "int64" + }, + "maxCandidates": { + "type": "string", + "format": "int64" + }, + "minScore": { + "type": "number", + "format": "double" + } + } + } + } +} diff --git a/pkg/server/gen/openapiv2/textclassification/v1/textclassification.swagger.json b/pkg/server/gen/openapiv2/textclassification/v1/textclassification.swagger.json new file mode 100644 index 0000000..a2d500a --- /dev/null +++ b/pkg/server/gen/openapiv2/textclassification/v1/textclassification.swagger.json @@ -0,0 +1,108 @@ +{ + "swagger": "2.0", + "info": { + "title": "textclassification/v1/textclassification.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "TextClassificationService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/classify": { + "post": { + "operationId": "TextClassificationService_Classify", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ClassifyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1ClassifyRequest" + } + } + ], + "tags": [ + "TextClassificationService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1ClassifyRequest": { + "type": "object", + "properties": { + "input": { + "type": "string" + } + } + }, + "v1ClassifyResponse": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "type": "string" + } + }, + "scores": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + } + } + } + } +} diff --git a/pkg/server/gen/openapiv2/textencoding/v1/textencoding.swagger.json b/pkg/server/gen/openapiv2/textencoding/v1/textencoding.swagger.json new file mode 100644 index 0000000..1b4ac08 --- /dev/null +++ b/pkg/server/gen/openapiv2/textencoding/v1/textencoding.swagger.json @@ -0,0 +1,106 @@ +{ + "swagger": "2.0", + "info": { + "title": "textencoding/v1/textencoding.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "TextEncodingService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/encode": { + "post": { + "operationId": "TextEncodingService_Encode", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1EncodingResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1EncodingRequest" + } + } + ], + "tags": [ + "TextEncodingService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1EncodingRequest": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "poolingStrategy": { + "type": "integer", + "format": "int32" + } + } + }, + "v1EncodingResponse": { + "type": "object", + "properties": { + "vector": { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + } + } + } +} diff --git a/pkg/server/gen/openapiv2/textgeneration/v1/texgeneration.swagger.json b/pkg/server/gen/openapiv2/textgeneration/v1/texgeneration.swagger.json new file mode 100644 index 0000000..7589785 --- /dev/null +++ b/pkg/server/gen/openapiv2/textgeneration/v1/texgeneration.swagger.json @@ -0,0 +1,131 @@ +{ + "swagger": "2.0", + "info": { + "title": "textgeneration/v1/texgeneration.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "TextGenerationService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/generate": { + "post": { + "operationId": "TextGenerationService_Generate", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GenerateResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1GenerateRequest" + } + } + ], + "tags": [ + "TextGenerationService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1GenerateRequest": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "parameters": { + "$ref": "#/definitions/v1TextGenerationParameters" + } + } + }, + "v1GenerateResponse": { + "type": "object", + "properties": { + "texts": { + "type": "array", + "items": { + "type": "string" + } + }, + "scores": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + } + } + }, + "v1TextGenerationParameters": { + "type": "object", + "properties": { + "topK": { + "type": "string", + "format": "int64" + }, + "topP": { + "type": "number", + "format": "double" + }, + "temperature": { + "type": "number", + "format": "double" + }, + "doSample": { + "type": "boolean" + } + } + } + } +} diff --git a/pkg/server/gen/openapiv2/tokenclassification/v1/tokenclassification.swagger.json b/pkg/server/gen/openapiv2/tokenclassification/v1/tokenclassification.swagger.json new file mode 100644 index 0000000..e775fc9 --- /dev/null +++ b/pkg/server/gen/openapiv2/tokenclassification/v1/tokenclassification.swagger.json @@ -0,0 +1,137 @@ +{ + "swagger": "2.0", + "info": { + "title": "tokenclassification/v1/tokenclassification.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "TokenClassificationService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/classify": { + "post": { + "operationId": "TokenClassificationService_Classify", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ClassifyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1ClassifyRequest" + } + } + ], + "tags": [ + "TokenClassificationService" + ] + } + } + }, + "definitions": { + "ClassifyRequestAggregationStrategy": { + "type": "string", + "enum": [ + "NONE", + "SIMPLE" + ], + "default": "NONE", + "title": "- NONE: Every token gets classified without further aggregation (default)\n - SIMPLE: Entities are grouped according to the IOB annotation schema" + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1ClassifyRequest": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "aggregationStrategy": { + "$ref": "#/definitions/ClassifyRequestAggregationStrategy" + } + } + }, + "v1ClassifyResponse": { + "type": "object", + "properties": { + "tokens": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Token" + } + } + } + }, + "v1Token": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "start": { + "type": "integer", + "format": "int32" + }, + "end": { + "type": "integer", + "format": "int32" + }, + "label": { + "type": "string" + }, + "score": { + "type": "number", + "format": "double" + } + } + } + } +} diff --git a/pkg/server/gen/openapiv2/zeroshot/v1/zeroshot.swagger.json b/pkg/server/gen/openapiv2/zeroshot/v1/zeroshot.swagger.json new file mode 100644 index 0000000..9998128 --- /dev/null +++ b/pkg/server/gen/openapiv2/zeroshot/v1/zeroshot.swagger.json @@ -0,0 +1,129 @@ +{ + "swagger": "2.0", + "info": { + "title": "zeroshot/v1/zeroshot.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "ZeroShotService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/classify": { + "post": { + "operationId": "ZeroShotService_Classify", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ClassifyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1ClassifyRequest" + } + } + ], + "tags": [ + "ZeroShotService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1ClassifyRequest": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "parameters": { + "$ref": "#/definitions/v1ZeroShotParameters" + } + } + }, + "v1ClassifyResponse": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "title": "TODO: string sequence = ...; ?" + }, + "scores": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + } + } + }, + "v1ZeroShotParameters": { + "type": "object", + "properties": { + "hypothesisTemplate": { + "type": "string" + }, + "candidateLabels": { + "type": "array", + "items": { + "type": "string" + } + }, + "multiLabel": { + "type": "boolean" + } + } + } + } +} diff --git a/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.go b/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.go new file mode 100644 index 0000000..65ae012 --- /dev/null +++ b/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.go @@ -0,0 +1,397 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: languagemodeling/v1/languagemodeling.proto + +package languagemodelingv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LanguageModelingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` + Parameters *LanguageModelingParameters `protobuf:"bytes,2,opt,name=parameters,proto3" json:"parameters,omitempty"` +} + +func (x *LanguageModelingRequest) Reset() { + *x = LanguageModelingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LanguageModelingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LanguageModelingRequest) ProtoMessage() {} + +func (x *LanguageModelingRequest) ProtoReflect() protoreflect.Message { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[0] + 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 LanguageModelingRequest.ProtoReflect.Descriptor instead. +func (*LanguageModelingRequest) Descriptor() ([]byte, []int) { + return file_languagemodeling_v1_languagemodeling_proto_rawDescGZIP(), []int{0} +} + +func (x *LanguageModelingRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +func (x *LanguageModelingRequest) GetParameters() *LanguageModelingParameters { + if x != nil { + return x.Parameters + } + return nil +} + +type LanguageModelingParameters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + K int32 `protobuf:"varint,1,opt,name=k,proto3" json:"k,omitempty"` +} + +func (x *LanguageModelingParameters) Reset() { + *x = LanguageModelingParameters{} + if protoimpl.UnsafeEnabled { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LanguageModelingParameters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LanguageModelingParameters) ProtoMessage() {} + +func (x *LanguageModelingParameters) ProtoReflect() protoreflect.Message { + mi := &file_languagemodeling_v1_languagemodeling_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 LanguageModelingParameters.ProtoReflect.Descriptor instead. +func (*LanguageModelingParameters) Descriptor() ([]byte, []int) { + return file_languagemodeling_v1_languagemodeling_proto_rawDescGZIP(), []int{1} +} + +func (x *LanguageModelingParameters) GetK() int32 { + if x != nil { + return x.K + } + return 0 +} + +type Token struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Start int32 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + End int32 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + Words []string `protobuf:"bytes,3,rep,name=words,proto3" json:"words,omitempty"` + Scores []float64 `protobuf:"fixed64,4,rep,packed,name=scores,proto3" json:"scores,omitempty"` +} + +func (x *Token) Reset() { + *x = Token{} + if protoimpl.UnsafeEnabled { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Token) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Token) ProtoMessage() {} + +func (x *Token) ProtoReflect() protoreflect.Message { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[2] + 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 Token.ProtoReflect.Descriptor instead. +func (*Token) Descriptor() ([]byte, []int) { + return file_languagemodeling_v1_languagemodeling_proto_rawDescGZIP(), []int{2} +} + +func (x *Token) GetStart() int32 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *Token) GetEnd() int32 { + if x != nil { + return x.End + } + return 0 +} + +func (x *Token) GetWords() []string { + if x != nil { + return x.Words + } + return nil +} + +func (x *Token) GetScores() []float64 { + if x != nil { + return x.Scores + } + return nil +} + +type LanguageModelingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tokens []*Token `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` +} + +func (x *LanguageModelingResponse) Reset() { + *x = LanguageModelingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LanguageModelingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LanguageModelingResponse) ProtoMessage() {} + +func (x *LanguageModelingResponse) ProtoReflect() protoreflect.Message { + mi := &file_languagemodeling_v1_languagemodeling_proto_msgTypes[3] + 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 LanguageModelingResponse.ProtoReflect.Descriptor instead. +func (*LanguageModelingResponse) Descriptor() ([]byte, []int) { + return file_languagemodeling_v1_languagemodeling_proto_rawDescGZIP(), []int{3} +} + +func (x *LanguageModelingResponse) GetTokens() []*Token { + if x != nil { + return x.Tokens + } + return nil +} + +var File_languagemodeling_v1_languagemodeling_proto protoreflect.FileDescriptor + +var file_languagemodeling_v1_languagemodeling_proto_rawDesc = []byte{ + 0x0a, 0x2a, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x69, + 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x6c, 0x61, + 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x76, + 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x80, 0x01, 0x0a, 0x17, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x65, + 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, + 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x12, 0x4f, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x6e, 0x67, + 0x75, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x22, 0x2a, 0x0a, 0x1a, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x4d, 0x6f, + 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x0c, 0x0a, 0x01, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x6b, 0x22, 0x5d, + 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, + 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x01, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x22, 0x4e, 0x0a, + 0x18, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x61, 0x6e, 0x67, + 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x32, 0x99, 0x01, + 0x0a, 0x17, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x69, + 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x07, 0x50, 0x72, 0x65, + 0x64, 0x69, 0x63, 0x74, 0x12, 0x2c, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x6e, 0x67, 0x75, + 0x61, 0x67, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, + 0x31, 0x2f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x42, 0x58, 0x5a, 0x56, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6c, 0x70, 0x6f, 0x64, 0x79, 0x73, 0x73, + 0x65, 0x79, 0x2f, 0x63, 0x79, 0x62, 0x65, 0x72, 0x74, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x6c, 0x61, 0x6e, + 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, + 0x3b, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x69, 0x6e, + 0x67, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_languagemodeling_v1_languagemodeling_proto_rawDescOnce sync.Once + file_languagemodeling_v1_languagemodeling_proto_rawDescData = file_languagemodeling_v1_languagemodeling_proto_rawDesc +) + +func file_languagemodeling_v1_languagemodeling_proto_rawDescGZIP() []byte { + file_languagemodeling_v1_languagemodeling_proto_rawDescOnce.Do(func() { + file_languagemodeling_v1_languagemodeling_proto_rawDescData = protoimpl.X.CompressGZIP(file_languagemodeling_v1_languagemodeling_proto_rawDescData) + }) + return file_languagemodeling_v1_languagemodeling_proto_rawDescData +} + +var file_languagemodeling_v1_languagemodeling_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_languagemodeling_v1_languagemodeling_proto_goTypes = []interface{}{ + (*LanguageModelingRequest)(nil), // 0: languagemodeling.v1.LanguageModelingRequest + (*LanguageModelingParameters)(nil), // 1: languagemodeling.v1.LanguageModelingParameters + (*Token)(nil), // 2: languagemodeling.v1.Token + (*LanguageModelingResponse)(nil), // 3: languagemodeling.v1.LanguageModelingResponse +} +var file_languagemodeling_v1_languagemodeling_proto_depIdxs = []int32{ + 1, // 0: languagemodeling.v1.LanguageModelingRequest.parameters:type_name -> languagemodeling.v1.LanguageModelingParameters + 2, // 1: languagemodeling.v1.LanguageModelingResponse.tokens:type_name -> languagemodeling.v1.Token + 0, // 2: languagemodeling.v1.LanguageModelingService.Predict:input_type -> languagemodeling.v1.LanguageModelingRequest + 3, // 3: languagemodeling.v1.LanguageModelingService.Predict:output_type -> languagemodeling.v1.LanguageModelingResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_languagemodeling_v1_languagemodeling_proto_init() } +func file_languagemodeling_v1_languagemodeling_proto_init() { + if File_languagemodeling_v1_languagemodeling_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_languagemodeling_v1_languagemodeling_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LanguageModelingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_languagemodeling_v1_languagemodeling_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LanguageModelingParameters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_languagemodeling_v1_languagemodeling_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Token); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_languagemodeling_v1_languagemodeling_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LanguageModelingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_languagemodeling_v1_languagemodeling_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_languagemodeling_v1_languagemodeling_proto_goTypes, + DependencyIndexes: file_languagemodeling_v1_languagemodeling_proto_depIdxs, + MessageInfos: file_languagemodeling_v1_languagemodeling_proto_msgTypes, + }.Build() + File_languagemodeling_v1_languagemodeling_proto = out.File + file_languagemodeling_v1_languagemodeling_proto_rawDesc = nil + file_languagemodeling_v1_languagemodeling_proto_goTypes = nil + file_languagemodeling_v1_languagemodeling_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.gw.go b/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.gw.go new file mode 100644 index 0000000..36c44c7 --- /dev/null +++ b/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: languagemodeling/v1/languagemodeling.proto + +/* +Package languagemodelingv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package languagemodelingv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_LanguageModelingService_Predict_0(ctx context.Context, marshaler runtime.Marshaler, client LanguageModelingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LanguageModelingRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Predict(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_LanguageModelingService_Predict_0(ctx context.Context, marshaler runtime.Marshaler, server LanguageModelingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LanguageModelingRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Predict(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterLanguageModelingServiceHandlerServer registers the http handlers for service LanguageModelingService to "mux". +// UnaryRPC :call LanguageModelingServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLanguageModelingServiceHandlerFromEndpoint instead. +func RegisterLanguageModelingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LanguageModelingServiceServer) error { + + mux.Handle("POST", pattern_LanguageModelingService_Predict_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/languagemodeling.v1.LanguageModelingService/Predict", runtime.WithHTTPPathPattern("/v1/predict")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_LanguageModelingService_Predict_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_LanguageModelingService_Predict_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterLanguageModelingServiceHandlerFromEndpoint is same as RegisterLanguageModelingServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterLanguageModelingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterLanguageModelingServiceHandler(ctx, mux, conn) +} + +// RegisterLanguageModelingServiceHandler registers the http handlers for service LanguageModelingService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterLanguageModelingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterLanguageModelingServiceHandlerClient(ctx, mux, NewLanguageModelingServiceClient(conn)) +} + +// RegisterLanguageModelingServiceHandlerClient registers the http handlers for service LanguageModelingService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LanguageModelingServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LanguageModelingServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "LanguageModelingServiceClient" to call the correct interceptors. +func RegisterLanguageModelingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LanguageModelingServiceClient) error { + + mux.Handle("POST", pattern_LanguageModelingService_Predict_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/languagemodeling.v1.LanguageModelingService/Predict", runtime.WithHTTPPathPattern("/v1/predict")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_LanguageModelingService_Predict_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_LanguageModelingService_Predict_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_LanguageModelingService_Predict_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "predict"}, "")) +) + +var ( + forward_LanguageModelingService_Predict_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling_grpc.pb.go b/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling_grpc.pb.go new file mode 100644 index 0000000..e39c343 --- /dev/null +++ b/pkg/server/gen/proto/go/languagemodeling/v1/languagemodeling_grpc.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: languagemodeling/v1/languagemodeling.proto + +package languagemodelingv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + LanguageModelingService_Predict_FullMethodName = "/languagemodeling.v1.LanguageModelingService/Predict" +) + +// LanguageModelingServiceClient is the client API for LanguageModelingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type LanguageModelingServiceClient interface { + Predict(ctx context.Context, in *LanguageModelingRequest, opts ...grpc.CallOption) (*LanguageModelingResponse, error) +} + +type languageModelingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewLanguageModelingServiceClient(cc grpc.ClientConnInterface) LanguageModelingServiceClient { + return &languageModelingServiceClient{cc} +} + +func (c *languageModelingServiceClient) Predict(ctx context.Context, in *LanguageModelingRequest, opts ...grpc.CallOption) (*LanguageModelingResponse, error) { + out := new(LanguageModelingResponse) + err := c.cc.Invoke(ctx, LanguageModelingService_Predict_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LanguageModelingServiceServer is the server API for LanguageModelingService service. +// All implementations must embed UnimplementedLanguageModelingServiceServer +// for forward compatibility +type LanguageModelingServiceServer interface { + Predict(context.Context, *LanguageModelingRequest) (*LanguageModelingResponse, error) + mustEmbedUnimplementedLanguageModelingServiceServer() +} + +// UnimplementedLanguageModelingServiceServer must be embedded to have forward compatible implementations. +type UnimplementedLanguageModelingServiceServer struct { +} + +func (UnimplementedLanguageModelingServiceServer) Predict(context.Context, *LanguageModelingRequest) (*LanguageModelingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Predict not implemented") +} +func (UnimplementedLanguageModelingServiceServer) mustEmbedUnimplementedLanguageModelingServiceServer() { +} + +// UnsafeLanguageModelingServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LanguageModelingServiceServer will +// result in compilation errors. +type UnsafeLanguageModelingServiceServer interface { + mustEmbedUnimplementedLanguageModelingServiceServer() +} + +func RegisterLanguageModelingServiceServer(s grpc.ServiceRegistrar, srv LanguageModelingServiceServer) { + s.RegisterService(&LanguageModelingService_ServiceDesc, srv) +} + +func _LanguageModelingService_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LanguageModelingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LanguageModelingServiceServer).Predict(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LanguageModelingService_Predict_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LanguageModelingServiceServer).Predict(ctx, req.(*LanguageModelingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// LanguageModelingService_ServiceDesc is the grpc.ServiceDesc for LanguageModelingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LanguageModelingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "languagemodeling.v1.LanguageModelingService", + HandlerType: (*LanguageModelingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Predict", + Handler: _LanguageModelingService_Predict_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "languagemodeling/v1/languagemodeling.proto", +} diff --git a/pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.go b/pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.go new file mode 100644 index 0000000..06467a4 --- /dev/null +++ b/pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.go @@ -0,0 +1,445 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: questionanswering/v1/questionanswering.proto + +package questionansweringv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AnswerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Question string `protobuf:"bytes,1,opt,name=question,proto3" json:"question,omitempty"` + Passage string `protobuf:"bytes,2,opt,name=passage,proto3" json:"passage,omitempty"` + Options *QuestionAnsweringOptions `protobuf:"bytes,3,opt,name=options,proto3,oneof" json:"options,omitempty"` +} + +func (x *AnswerRequest) Reset() { + *x = AnswerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnswerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnswerRequest) ProtoMessage() {} + +func (x *AnswerRequest) ProtoReflect() protoreflect.Message { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[0] + 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 AnswerRequest.ProtoReflect.Descriptor instead. +func (*AnswerRequest) Descriptor() ([]byte, []int) { + return file_questionanswering_v1_questionanswering_proto_rawDescGZIP(), []int{0} +} + +func (x *AnswerRequest) GetQuestion() string { + if x != nil { + return x.Question + } + return "" +} + +func (x *AnswerRequest) GetPassage() string { + if x != nil { + return x.Passage + } + return "" +} + +func (x *AnswerRequest) GetOptions() *QuestionAnsweringOptions { + if x != nil { + return x.Options + } + return nil +} + +type QuestionAnsweringOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MaxAnswers *int64 `protobuf:"varint,1,opt,name=max_answers,json=maxAnswers,proto3,oneof" json:"max_answers,omitempty"` + MaxAnswersLen *int64 `protobuf:"varint,2,opt,name=max_answers_len,json=maxAnswersLen,proto3,oneof" json:"max_answers_len,omitempty"` + MaxCandidates *int64 `protobuf:"varint,3,opt,name=max_candidates,json=maxCandidates,proto3,oneof" json:"max_candidates,omitempty"` + MinScore *float64 `protobuf:"fixed64,4,opt,name=min_score,json=minScore,proto3,oneof" json:"min_score,omitempty"` +} + +func (x *QuestionAnsweringOptions) Reset() { + *x = QuestionAnsweringOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuestionAnsweringOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuestionAnsweringOptions) ProtoMessage() {} + +func (x *QuestionAnsweringOptions) ProtoReflect() protoreflect.Message { + mi := &file_questionanswering_v1_questionanswering_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 QuestionAnsweringOptions.ProtoReflect.Descriptor instead. +func (*QuestionAnsweringOptions) Descriptor() ([]byte, []int) { + return file_questionanswering_v1_questionanswering_proto_rawDescGZIP(), []int{1} +} + +func (x *QuestionAnsweringOptions) GetMaxAnswers() int64 { + if x != nil && x.MaxAnswers != nil { + return *x.MaxAnswers + } + return 0 +} + +func (x *QuestionAnsweringOptions) GetMaxAnswersLen() int64 { + if x != nil && x.MaxAnswersLen != nil { + return *x.MaxAnswersLen + } + return 0 +} + +func (x *QuestionAnsweringOptions) GetMaxCandidates() int64 { + if x != nil && x.MaxCandidates != nil { + return *x.MaxCandidates + } + return 0 +} + +func (x *QuestionAnsweringOptions) GetMinScore() float64 { + if x != nil && x.MinScore != nil { + return *x.MinScore + } + return 0 +} + +type AnswerResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Answers []*Answer `protobuf:"bytes,1,rep,name=answers,proto3" json:"answers,omitempty"` +} + +func (x *AnswerResponse) Reset() { + *x = AnswerResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnswerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnswerResponse) ProtoMessage() {} + +func (x *AnswerResponse) ProtoReflect() protoreflect.Message { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[2] + 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 AnswerResponse.ProtoReflect.Descriptor instead. +func (*AnswerResponse) Descriptor() ([]byte, []int) { + return file_questionanswering_v1_questionanswering_proto_rawDescGZIP(), []int{2} +} + +func (x *AnswerResponse) GetAnswers() []*Answer { + if x != nil { + return x.Answers + } + return nil +} + +type Answer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` + Start int64 `protobuf:"varint,2,opt,name=start,proto3" json:"start,omitempty"` + End int64 `protobuf:"varint,3,opt,name=end,proto3" json:"end,omitempty"` + Score float64 `protobuf:"fixed64,4,opt,name=score,proto3" json:"score,omitempty"` +} + +func (x *Answer) Reset() { + *x = Answer{} + if protoimpl.UnsafeEnabled { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Answer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Answer) ProtoMessage() {} + +func (x *Answer) ProtoReflect() protoreflect.Message { + mi := &file_questionanswering_v1_questionanswering_proto_msgTypes[3] + 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 Answer.ProtoReflect.Descriptor instead. +func (*Answer) Descriptor() ([]byte, []int) { + return file_questionanswering_v1_questionanswering_proto_rawDescGZIP(), []int{3} +} + +func (x *Answer) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Answer) GetStart() int64 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *Answer) GetEnd() int64 { + if x != nil { + return x.End + } + return 0 +} + +func (x *Answer) GetScore() float64 { + if x != nil { + return x.Score + } + return 0 +} + +var File_questionanswering_v1_questionanswering_proto protoreflect.FileDescriptor + +var file_questionanswering_v1_questionanswering_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, + 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, + 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xa0, 0x01, 0x0a, 0x0d, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x70, 0x61, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x4d, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, + 0x72, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x80, 0x02, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, + 0x6f, 0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x41, 0x6e, + 0x73, 0x77, 0x65, 0x72, 0x73, 0x88, 0x01, 0x01, 0x12, 0x2b, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, + 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x73, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x48, 0x01, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x73, 0x4c, + 0x65, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x61, 0x6e, + 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x02, 0x52, + 0x0d, 0x6d, 0x61, 0x78, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x73, 0x88, 0x01, + 0x01, 0x12, 0x20, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x01, 0x48, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x53, 0x63, 0x6f, 0x72, 0x65, + 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6e, 0x73, 0x77, + 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6e, 0x73, 0x77, + 0x65, 0x72, 0x73, 0x5f, 0x6c, 0x65, 0x6e, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x6d, 0x61, 0x78, 0x5f, + 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6d, + 0x69, 0x6e, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x48, 0x0a, 0x0e, 0x41, 0x6e, 0x73, 0x77, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x61, 0x6e, + 0x73, 0x77, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x07, 0x61, 0x6e, 0x73, 0x77, 0x65, + 0x72, 0x73, 0x22, 0x5a, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x32, 0x86, + 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, + 0x72, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6a, 0x0a, 0x06, 0x41, + 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x73, + 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x76, 0x31, + 0x2f, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x42, 0x5a, 0x5a, 0x58, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6c, 0x70, 0x6f, 0x64, 0x79, 0x73, 0x73, 0x65, 0x79, + 0x2f, 0x63, 0x79, 0x62, 0x65, 0x72, 0x74, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x69, 0x6e, + 0x67, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_questionanswering_v1_questionanswering_proto_rawDescOnce sync.Once + file_questionanswering_v1_questionanswering_proto_rawDescData = file_questionanswering_v1_questionanswering_proto_rawDesc +) + +func file_questionanswering_v1_questionanswering_proto_rawDescGZIP() []byte { + file_questionanswering_v1_questionanswering_proto_rawDescOnce.Do(func() { + file_questionanswering_v1_questionanswering_proto_rawDescData = protoimpl.X.CompressGZIP(file_questionanswering_v1_questionanswering_proto_rawDescData) + }) + return file_questionanswering_v1_questionanswering_proto_rawDescData +} + +var file_questionanswering_v1_questionanswering_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_questionanswering_v1_questionanswering_proto_goTypes = []interface{}{ + (*AnswerRequest)(nil), // 0: questionanswering.v1.AnswerRequest + (*QuestionAnsweringOptions)(nil), // 1: questionanswering.v1.QuestionAnsweringOptions + (*AnswerResponse)(nil), // 2: questionanswering.v1.AnswerResponse + (*Answer)(nil), // 3: questionanswering.v1.Answer +} +var file_questionanswering_v1_questionanswering_proto_depIdxs = []int32{ + 1, // 0: questionanswering.v1.AnswerRequest.options:type_name -> questionanswering.v1.QuestionAnsweringOptions + 3, // 1: questionanswering.v1.AnswerResponse.answers:type_name -> questionanswering.v1.Answer + 0, // 2: questionanswering.v1.QuestionAnsweringService.Answer:input_type -> questionanswering.v1.AnswerRequest + 2, // 3: questionanswering.v1.QuestionAnsweringService.Answer:output_type -> questionanswering.v1.AnswerResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_questionanswering_v1_questionanswering_proto_init() } +func file_questionanswering_v1_questionanswering_proto_init() { + if File_questionanswering_v1_questionanswering_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_questionanswering_v1_questionanswering_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnswerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_questionanswering_v1_questionanswering_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuestionAnsweringOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_questionanswering_v1_questionanswering_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnswerResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_questionanswering_v1_questionanswering_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Answer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_questionanswering_v1_questionanswering_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_questionanswering_v1_questionanswering_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_questionanswering_v1_questionanswering_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_questionanswering_v1_questionanswering_proto_goTypes, + DependencyIndexes: file_questionanswering_v1_questionanswering_proto_depIdxs, + MessageInfos: file_questionanswering_v1_questionanswering_proto_msgTypes, + }.Build() + File_questionanswering_v1_questionanswering_proto = out.File + file_questionanswering_v1_questionanswering_proto_rawDesc = nil + file_questionanswering_v1_questionanswering_proto_goTypes = nil + file_questionanswering_v1_questionanswering_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.gw.go b/pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.gw.go new file mode 100644 index 0000000..45ebcdf --- /dev/null +++ b/pkg/server/gen/proto/go/questionanswering/v1/questionanswering.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: questionanswering/v1/questionanswering.proto + +/* +Package questionansweringv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package questionansweringv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_QuestionAnsweringService_Answer_0(ctx context.Context, marshaler runtime.Marshaler, client QuestionAnsweringServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AnswerRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Answer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_QuestionAnsweringService_Answer_0(ctx context.Context, marshaler runtime.Marshaler, server QuestionAnsweringServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AnswerRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Answer(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQuestionAnsweringServiceHandlerServer registers the http handlers for service QuestionAnsweringService to "mux". +// UnaryRPC :call QuestionAnsweringServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQuestionAnsweringServiceHandlerFromEndpoint instead. +func RegisterQuestionAnsweringServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QuestionAnsweringServiceServer) error { + + mux.Handle("POST", pattern_QuestionAnsweringService_Answer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/questionanswering.v1.QuestionAnsweringService/Answer", runtime.WithHTTPPathPattern("/v1/answer")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_QuestionAnsweringService_Answer_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_QuestionAnsweringService_Answer_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQuestionAnsweringServiceHandlerFromEndpoint is same as RegisterQuestionAnsweringServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQuestionAnsweringServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQuestionAnsweringServiceHandler(ctx, mux, conn) +} + +// RegisterQuestionAnsweringServiceHandler registers the http handlers for service QuestionAnsweringService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQuestionAnsweringServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQuestionAnsweringServiceHandlerClient(ctx, mux, NewQuestionAnsweringServiceClient(conn)) +} + +// RegisterQuestionAnsweringServiceHandlerClient registers the http handlers for service QuestionAnsweringService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QuestionAnsweringServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QuestionAnsweringServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QuestionAnsweringServiceClient" to call the correct interceptors. +func RegisterQuestionAnsweringServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QuestionAnsweringServiceClient) error { + + mux.Handle("POST", pattern_QuestionAnsweringService_Answer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/questionanswering.v1.QuestionAnsweringService/Answer", runtime.WithHTTPPathPattern("/v1/answer")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_QuestionAnsweringService_Answer_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_QuestionAnsweringService_Answer_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_QuestionAnsweringService_Answer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "answer"}, "")) +) + +var ( + forward_QuestionAnsweringService_Answer_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/questionanswering/v1/questionanswering_grpc.pb.go b/pkg/server/gen/proto/go/questionanswering/v1/questionanswering_grpc.pb.go new file mode 100644 index 0000000..7229625 --- /dev/null +++ b/pkg/server/gen/proto/go/questionanswering/v1/questionanswering_grpc.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: questionanswering/v1/questionanswering.proto + +package questionansweringv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + QuestionAnsweringService_Answer_FullMethodName = "/questionanswering.v1.QuestionAnsweringService/Answer" +) + +// QuestionAnsweringServiceClient is the client API for QuestionAnsweringService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type QuestionAnsweringServiceClient interface { + Answer(ctx context.Context, in *AnswerRequest, opts ...grpc.CallOption) (*AnswerResponse, error) +} + +type questionAnsweringServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewQuestionAnsweringServiceClient(cc grpc.ClientConnInterface) QuestionAnsweringServiceClient { + return &questionAnsweringServiceClient{cc} +} + +func (c *questionAnsweringServiceClient) Answer(ctx context.Context, in *AnswerRequest, opts ...grpc.CallOption) (*AnswerResponse, error) { + out := new(AnswerResponse) + err := c.cc.Invoke(ctx, QuestionAnsweringService_Answer_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QuestionAnsweringServiceServer is the server API for QuestionAnsweringService service. +// All implementations must embed UnimplementedQuestionAnsweringServiceServer +// for forward compatibility +type QuestionAnsweringServiceServer interface { + Answer(context.Context, *AnswerRequest) (*AnswerResponse, error) + mustEmbedUnimplementedQuestionAnsweringServiceServer() +} + +// UnimplementedQuestionAnsweringServiceServer must be embedded to have forward compatible implementations. +type UnimplementedQuestionAnsweringServiceServer struct { +} + +func (UnimplementedQuestionAnsweringServiceServer) Answer(context.Context, *AnswerRequest) (*AnswerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Answer not implemented") +} +func (UnimplementedQuestionAnsweringServiceServer) mustEmbedUnimplementedQuestionAnsweringServiceServer() { +} + +// UnsafeQuestionAnsweringServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QuestionAnsweringServiceServer will +// result in compilation errors. +type UnsafeQuestionAnsweringServiceServer interface { + mustEmbedUnimplementedQuestionAnsweringServiceServer() +} + +func RegisterQuestionAnsweringServiceServer(s grpc.ServiceRegistrar, srv QuestionAnsweringServiceServer) { + s.RegisterService(&QuestionAnsweringService_ServiceDesc, srv) +} + +func _QuestionAnsweringService_Answer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnswerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QuestionAnsweringServiceServer).Answer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: QuestionAnsweringService_Answer_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QuestionAnsweringServiceServer).Answer(ctx, req.(*AnswerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// QuestionAnsweringService_ServiceDesc is the grpc.ServiceDesc for QuestionAnsweringService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var QuestionAnsweringService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "questionanswering.v1.QuestionAnsweringService", + HandlerType: (*QuestionAnsweringServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Answer", + Handler: _QuestionAnsweringService_Answer_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "questionanswering/v1/questionanswering.proto", +} diff --git a/pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.go b/pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.go new file mode 100644 index 0000000..439e976 --- /dev/null +++ b/pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.go @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: textclassification/v1/textclassification.proto + +package textclassificationv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ClassifyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` +} + +func (x *ClassifyRequest) Reset() { + *x = ClassifyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_textclassification_v1_textclassification_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClassifyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClassifyRequest) ProtoMessage() {} + +func (x *ClassifyRequest) ProtoReflect() protoreflect.Message { + mi := &file_textclassification_v1_textclassification_proto_msgTypes[0] + 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 ClassifyRequest.ProtoReflect.Descriptor instead. +func (*ClassifyRequest) Descriptor() ([]byte, []int) { + return file_textclassification_v1_textclassification_proto_rawDescGZIP(), []int{0} +} + +func (x *ClassifyRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +type ClassifyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Labels []string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` + Scores []float64 `protobuf:"fixed64,2,rep,packed,name=scores,proto3" json:"scores,omitempty"` +} + +func (x *ClassifyResponse) Reset() { + *x = ClassifyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_textclassification_v1_textclassification_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClassifyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClassifyResponse) ProtoMessage() {} + +func (x *ClassifyResponse) ProtoReflect() protoreflect.Message { + mi := &file_textclassification_v1_textclassification_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 ClassifyResponse.ProtoReflect.Descriptor instead. +func (*ClassifyResponse) Descriptor() ([]byte, []int) { + return file_textclassification_v1_textclassification_proto_rawDescGZIP(), []int{1} +} + +func (x *ClassifyResponse) GetLabels() []string { + if x != nil { + return x.Labels + } + return nil +} + +func (x *ClassifyResponse) GetScores() []float64 { + if x != nil { + return x.Scores + } + return nil +} + +var File_textclassification_v1_textclassification_proto protoreflect.FileDescriptor + +var file_textclassification_v1_textclassification_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x15, 0x74, 0x65, 0x78, 0x74, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x27, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x22, 0x42, + 0x0a, 0x10, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x01, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, + 0x65, 0x73, 0x32, 0x91, 0x01, 0x0a, 0x19, 0x54, 0x65, 0x78, 0x74, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x74, 0x0a, 0x08, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x12, 0x26, 0x2e, 0x74, + 0x65, 0x78, 0x74, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x42, 0x5c, 0x5a, 0x5a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6c, 0x70, 0x6f, 0x64, 0x79, 0x73, 0x73, 0x65, 0x79, 0x2f, + 0x63, 0x79, 0x62, 0x65, 0x72, 0x74, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, + 0x74, 0x65, 0x78, 0x74, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_textclassification_v1_textclassification_proto_rawDescOnce sync.Once + file_textclassification_v1_textclassification_proto_rawDescData = file_textclassification_v1_textclassification_proto_rawDesc +) + +func file_textclassification_v1_textclassification_proto_rawDescGZIP() []byte { + file_textclassification_v1_textclassification_proto_rawDescOnce.Do(func() { + file_textclassification_v1_textclassification_proto_rawDescData = protoimpl.X.CompressGZIP(file_textclassification_v1_textclassification_proto_rawDescData) + }) + return file_textclassification_v1_textclassification_proto_rawDescData +} + +var file_textclassification_v1_textclassification_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_textclassification_v1_textclassification_proto_goTypes = []interface{}{ + (*ClassifyRequest)(nil), // 0: textclassification.v1.ClassifyRequest + (*ClassifyResponse)(nil), // 1: textclassification.v1.ClassifyResponse +} +var file_textclassification_v1_textclassification_proto_depIdxs = []int32{ + 0, // 0: textclassification.v1.TextClassificationService.Classify:input_type -> textclassification.v1.ClassifyRequest + 1, // 1: textclassification.v1.TextClassificationService.Classify:output_type -> textclassification.v1.ClassifyResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_textclassification_v1_textclassification_proto_init() } +func file_textclassification_v1_textclassification_proto_init() { + if File_textclassification_v1_textclassification_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_textclassification_v1_textclassification_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClassifyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_textclassification_v1_textclassification_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClassifyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_textclassification_v1_textclassification_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_textclassification_v1_textclassification_proto_goTypes, + DependencyIndexes: file_textclassification_v1_textclassification_proto_depIdxs, + MessageInfos: file_textclassification_v1_textclassification_proto_msgTypes, + }.Build() + File_textclassification_v1_textclassification_proto = out.File + file_textclassification_v1_textclassification_proto_rawDesc = nil + file_textclassification_v1_textclassification_proto_goTypes = nil + file_textclassification_v1_textclassification_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.gw.go b/pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.gw.go new file mode 100644 index 0000000..e290d57 --- /dev/null +++ b/pkg/server/gen/proto/go/textclassification/v1/textclassification.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: textclassification/v1/textclassification.proto + +/* +Package textclassificationv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package textclassificationv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TextClassificationService_Classify_0(ctx context.Context, marshaler runtime.Marshaler, client TextClassificationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ClassifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Classify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TextClassificationService_Classify_0(ctx context.Context, marshaler runtime.Marshaler, server TextClassificationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ClassifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Classify(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTextClassificationServiceHandlerServer registers the http handlers for service TextClassificationService to "mux". +// UnaryRPC :call TextClassificationServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTextClassificationServiceHandlerFromEndpoint instead. +func RegisterTextClassificationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TextClassificationServiceServer) error { + + mux.Handle("POST", pattern_TextClassificationService_Classify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/textclassification.v1.TextClassificationService/Classify", runtime.WithHTTPPathPattern("/v1/classify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TextClassificationService_Classify_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TextClassificationService_Classify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTextClassificationServiceHandlerFromEndpoint is same as RegisterTextClassificationServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTextClassificationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTextClassificationServiceHandler(ctx, mux, conn) +} + +// RegisterTextClassificationServiceHandler registers the http handlers for service TextClassificationService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTextClassificationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTextClassificationServiceHandlerClient(ctx, mux, NewTextClassificationServiceClient(conn)) +} + +// RegisterTextClassificationServiceHandlerClient registers the http handlers for service TextClassificationService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TextClassificationServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TextClassificationServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TextClassificationServiceClient" to call the correct interceptors. +func RegisterTextClassificationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TextClassificationServiceClient) error { + + mux.Handle("POST", pattern_TextClassificationService_Classify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/textclassification.v1.TextClassificationService/Classify", runtime.WithHTTPPathPattern("/v1/classify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TextClassificationService_Classify_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TextClassificationService_Classify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TextClassificationService_Classify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "classify"}, "")) +) + +var ( + forward_TextClassificationService_Classify_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/textclassification/v1/textclassification_grpc.pb.go b/pkg/server/gen/proto/go/textclassification/v1/textclassification_grpc.pb.go new file mode 100644 index 0000000..ad3ca6b --- /dev/null +++ b/pkg/server/gen/proto/go/textclassification/v1/textclassification_grpc.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: textclassification/v1/textclassification.proto + +package textclassificationv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + TextClassificationService_Classify_FullMethodName = "/textclassification.v1.TextClassificationService/Classify" +) + +// TextClassificationServiceClient is the client API for TextClassificationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TextClassificationServiceClient interface { + Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error) +} + +type textClassificationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTextClassificationServiceClient(cc grpc.ClientConnInterface) TextClassificationServiceClient { + return &textClassificationServiceClient{cc} +} + +func (c *textClassificationServiceClient) Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error) { + out := new(ClassifyResponse) + err := c.cc.Invoke(ctx, TextClassificationService_Classify_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TextClassificationServiceServer is the server API for TextClassificationService service. +// All implementations must embed UnimplementedTextClassificationServiceServer +// for forward compatibility +type TextClassificationServiceServer interface { + Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error) + mustEmbedUnimplementedTextClassificationServiceServer() +} + +// UnimplementedTextClassificationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTextClassificationServiceServer struct { +} + +func (UnimplementedTextClassificationServiceServer) Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Classify not implemented") +} +func (UnimplementedTextClassificationServiceServer) mustEmbedUnimplementedTextClassificationServiceServer() { +} + +// UnsafeTextClassificationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TextClassificationServiceServer will +// result in compilation errors. +type UnsafeTextClassificationServiceServer interface { + mustEmbedUnimplementedTextClassificationServiceServer() +} + +func RegisterTextClassificationServiceServer(s grpc.ServiceRegistrar, srv TextClassificationServiceServer) { + s.RegisterService(&TextClassificationService_ServiceDesc, srv) +} + +func _TextClassificationService_Classify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClassifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TextClassificationServiceServer).Classify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TextClassificationService_Classify_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TextClassificationServiceServer).Classify(ctx, req.(*ClassifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TextClassificationService_ServiceDesc is the grpc.ServiceDesc for TextClassificationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TextClassificationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "textclassification.v1.TextClassificationService", + HandlerType: (*TextClassificationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Classify", + Handler: _TextClassificationService_Classify_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "textclassification/v1/textclassification.proto", +} diff --git a/pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.go b/pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.go new file mode 100644 index 0000000..ba68dd1 --- /dev/null +++ b/pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.go @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: textencoding/v1/textencoding.proto + +package textencodingv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type EncodingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` + PoolingStrategy int32 `protobuf:"varint,2,opt,name=pooling_strategy,json=poolingStrategy,proto3" json:"pooling_strategy,omitempty"` +} + +func (x *EncodingRequest) Reset() { + *x = EncodingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_textencoding_v1_textencoding_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EncodingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncodingRequest) ProtoMessage() {} + +func (x *EncodingRequest) ProtoReflect() protoreflect.Message { + mi := &file_textencoding_v1_textencoding_proto_msgTypes[0] + 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 EncodingRequest.ProtoReflect.Descriptor instead. +func (*EncodingRequest) Descriptor() ([]byte, []int) { + return file_textencoding_v1_textencoding_proto_rawDescGZIP(), []int{0} +} + +func (x *EncodingRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +func (x *EncodingRequest) GetPoolingStrategy() int32 { + if x != nil { + return x.PoolingStrategy + } + return 0 +} + +type EncodingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Vector []float32 `protobuf:"fixed32,1,rep,packed,name=vector,proto3" json:"vector,omitempty"` +} + +func (x *EncodingResponse) Reset() { + *x = EncodingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_textencoding_v1_textencoding_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EncodingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncodingResponse) ProtoMessage() {} + +func (x *EncodingResponse) ProtoReflect() protoreflect.Message { + mi := &file_textencoding_v1_textencoding_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 EncodingResponse.ProtoReflect.Descriptor instead. +func (*EncodingResponse) Descriptor() ([]byte, []int) { + return file_textencoding_v1_textencoding_proto_rawDescGZIP(), []int{1} +} + +func (x *EncodingResponse) GetVector() []float32 { + if x != nil { + return x.Vector + } + return nil +} + +var File_textencoding_v1_textencoding_proto protoreflect.FileDescriptor + +var file_textencoding_v1_textencoding_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2f, 0x76, + 0x31, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, + 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x0f, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x10, + 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x53, + 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x22, 0x2a, 0x0a, 0x10, 0x45, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x02, 0x52, 0x06, 0x76, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x32, 0x7b, 0x0a, 0x13, 0x54, 0x65, 0x78, 0x74, 0x45, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x64, 0x0a, 0x06, 0x45, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, + 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, + 0x42, 0x50, 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x6c, 0x70, 0x6f, 0x64, 0x79, 0x73, 0x73, 0x65, 0x79, 0x2f, 0x63, 0x79, 0x62, 0x65, 0x72, 0x74, + 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, + 0x70, 0x69, 0x73, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, + 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_textencoding_v1_textencoding_proto_rawDescOnce sync.Once + file_textencoding_v1_textencoding_proto_rawDescData = file_textencoding_v1_textencoding_proto_rawDesc +) + +func file_textencoding_v1_textencoding_proto_rawDescGZIP() []byte { + file_textencoding_v1_textencoding_proto_rawDescOnce.Do(func() { + file_textencoding_v1_textencoding_proto_rawDescData = protoimpl.X.CompressGZIP(file_textencoding_v1_textencoding_proto_rawDescData) + }) + return file_textencoding_v1_textencoding_proto_rawDescData +} + +var file_textencoding_v1_textencoding_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_textencoding_v1_textencoding_proto_goTypes = []interface{}{ + (*EncodingRequest)(nil), // 0: textencoding.v1.EncodingRequest + (*EncodingResponse)(nil), // 1: textencoding.v1.EncodingResponse +} +var file_textencoding_v1_textencoding_proto_depIdxs = []int32{ + 0, // 0: textencoding.v1.TextEncodingService.Encode:input_type -> textencoding.v1.EncodingRequest + 1, // 1: textencoding.v1.TextEncodingService.Encode:output_type -> textencoding.v1.EncodingResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_textencoding_v1_textencoding_proto_init() } +func file_textencoding_v1_textencoding_proto_init() { + if File_textencoding_v1_textencoding_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_textencoding_v1_textencoding_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncodingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_textencoding_v1_textencoding_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncodingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_textencoding_v1_textencoding_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_textencoding_v1_textencoding_proto_goTypes, + DependencyIndexes: file_textencoding_v1_textencoding_proto_depIdxs, + MessageInfos: file_textencoding_v1_textencoding_proto_msgTypes, + }.Build() + File_textencoding_v1_textencoding_proto = out.File + file_textencoding_v1_textencoding_proto_rawDesc = nil + file_textencoding_v1_textencoding_proto_goTypes = nil + file_textencoding_v1_textencoding_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.gw.go b/pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.gw.go new file mode 100644 index 0000000..e4b9f2b --- /dev/null +++ b/pkg/server/gen/proto/go/textencoding/v1/textencoding.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: textencoding/v1/textencoding.proto + +/* +Package textencodingv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package textencodingv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TextEncodingService_Encode_0(ctx context.Context, marshaler runtime.Marshaler, client TextEncodingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EncodingRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Encode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TextEncodingService_Encode_0(ctx context.Context, marshaler runtime.Marshaler, server TextEncodingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EncodingRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Encode(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTextEncodingServiceHandlerServer registers the http handlers for service TextEncodingService to "mux". +// UnaryRPC :call TextEncodingServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTextEncodingServiceHandlerFromEndpoint instead. +func RegisterTextEncodingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TextEncodingServiceServer) error { + + mux.Handle("POST", pattern_TextEncodingService_Encode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/textencoding.v1.TextEncodingService/Encode", runtime.WithHTTPPathPattern("/v1/encode")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TextEncodingService_Encode_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TextEncodingService_Encode_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTextEncodingServiceHandlerFromEndpoint is same as RegisterTextEncodingServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTextEncodingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTextEncodingServiceHandler(ctx, mux, conn) +} + +// RegisterTextEncodingServiceHandler registers the http handlers for service TextEncodingService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTextEncodingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTextEncodingServiceHandlerClient(ctx, mux, NewTextEncodingServiceClient(conn)) +} + +// RegisterTextEncodingServiceHandlerClient registers the http handlers for service TextEncodingService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TextEncodingServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TextEncodingServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TextEncodingServiceClient" to call the correct interceptors. +func RegisterTextEncodingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TextEncodingServiceClient) error { + + mux.Handle("POST", pattern_TextEncodingService_Encode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/textencoding.v1.TextEncodingService/Encode", runtime.WithHTTPPathPattern("/v1/encode")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TextEncodingService_Encode_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TextEncodingService_Encode_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TextEncodingService_Encode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "encode"}, "")) +) + +var ( + forward_TextEncodingService_Encode_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/textencoding/v1/textencoding_grpc.pb.go b/pkg/server/gen/proto/go/textencoding/v1/textencoding_grpc.pb.go new file mode 100644 index 0000000..e695e40 --- /dev/null +++ b/pkg/server/gen/proto/go/textencoding/v1/textencoding_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: textencoding/v1/textencoding.proto + +package textencodingv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + TextEncodingService_Encode_FullMethodName = "/textencoding.v1.TextEncodingService/Encode" +) + +// TextEncodingServiceClient is the client API for TextEncodingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TextEncodingServiceClient interface { + Encode(ctx context.Context, in *EncodingRequest, opts ...grpc.CallOption) (*EncodingResponse, error) +} + +type textEncodingServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTextEncodingServiceClient(cc grpc.ClientConnInterface) TextEncodingServiceClient { + return &textEncodingServiceClient{cc} +} + +func (c *textEncodingServiceClient) Encode(ctx context.Context, in *EncodingRequest, opts ...grpc.CallOption) (*EncodingResponse, error) { + out := new(EncodingResponse) + err := c.cc.Invoke(ctx, TextEncodingService_Encode_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TextEncodingServiceServer is the server API for TextEncodingService service. +// All implementations must embed UnimplementedTextEncodingServiceServer +// for forward compatibility +type TextEncodingServiceServer interface { + Encode(context.Context, *EncodingRequest) (*EncodingResponse, error) + mustEmbedUnimplementedTextEncodingServiceServer() +} + +// UnimplementedTextEncodingServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTextEncodingServiceServer struct { +} + +func (UnimplementedTextEncodingServiceServer) Encode(context.Context, *EncodingRequest) (*EncodingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Encode not implemented") +} +func (UnimplementedTextEncodingServiceServer) mustEmbedUnimplementedTextEncodingServiceServer() {} + +// UnsafeTextEncodingServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TextEncodingServiceServer will +// result in compilation errors. +type UnsafeTextEncodingServiceServer interface { + mustEmbedUnimplementedTextEncodingServiceServer() +} + +func RegisterTextEncodingServiceServer(s grpc.ServiceRegistrar, srv TextEncodingServiceServer) { + s.RegisterService(&TextEncodingService_ServiceDesc, srv) +} + +func _TextEncodingService_Encode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EncodingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TextEncodingServiceServer).Encode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TextEncodingService_Encode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TextEncodingServiceServer).Encode(ctx, req.(*EncodingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TextEncodingService_ServiceDesc is the grpc.ServiceDesc for TextEncodingService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TextEncodingService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "textencoding.v1.TextEncodingService", + HandlerType: (*TextEncodingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Encode", + Handler: _TextEncodingService_Encode_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "textencoding/v1/textencoding.proto", +} diff --git a/pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.go b/pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.go new file mode 100644 index 0000000..7082bd8 --- /dev/null +++ b/pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.go @@ -0,0 +1,348 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: textgeneration/v1/texgeneration.proto + +package textgenerationv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GenerateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` + Parameters *TextGenerationParameters `protobuf:"bytes,2,opt,name=parameters,proto3,oneof" json:"parameters,omitempty"` +} + +func (x *GenerateRequest) Reset() { + *x = GenerateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_textgeneration_v1_texgeneration_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateRequest) ProtoMessage() {} + +func (x *GenerateRequest) ProtoReflect() protoreflect.Message { + mi := &file_textgeneration_v1_texgeneration_proto_msgTypes[0] + 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 GenerateRequest.ProtoReflect.Descriptor instead. +func (*GenerateRequest) Descriptor() ([]byte, []int) { + return file_textgeneration_v1_texgeneration_proto_rawDescGZIP(), []int{0} +} + +func (x *GenerateRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +func (x *GenerateRequest) GetParameters() *TextGenerationParameters { + if x != nil { + return x.Parameters + } + return nil +} + +type TextGenerationParameters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TopK *int64 `protobuf:"varint,1,opt,name=top_k,json=topK,proto3,oneof" json:"top_k,omitempty"` + TopP *float64 `protobuf:"fixed64,2,opt,name=top_p,json=topP,proto3,oneof" json:"top_p,omitempty"` + Temperature *float64 `protobuf:"fixed64,3,opt,name=temperature,proto3,oneof" json:"temperature,omitempty"` + DoSample *bool `protobuf:"varint,4,opt,name=do_sample,json=doSample,proto3,oneof" json:"do_sample,omitempty"` +} + +func (x *TextGenerationParameters) Reset() { + *x = TextGenerationParameters{} + if protoimpl.UnsafeEnabled { + mi := &file_textgeneration_v1_texgeneration_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TextGenerationParameters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TextGenerationParameters) ProtoMessage() {} + +func (x *TextGenerationParameters) ProtoReflect() protoreflect.Message { + mi := &file_textgeneration_v1_texgeneration_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 TextGenerationParameters.ProtoReflect.Descriptor instead. +func (*TextGenerationParameters) Descriptor() ([]byte, []int) { + return file_textgeneration_v1_texgeneration_proto_rawDescGZIP(), []int{1} +} + +func (x *TextGenerationParameters) GetTopK() int64 { + if x != nil && x.TopK != nil { + return *x.TopK + } + return 0 +} + +func (x *TextGenerationParameters) GetTopP() float64 { + if x != nil && x.TopP != nil { + return *x.TopP + } + return 0 +} + +func (x *TextGenerationParameters) GetTemperature() float64 { + if x != nil && x.Temperature != nil { + return *x.Temperature + } + return 0 +} + +func (x *TextGenerationParameters) GetDoSample() bool { + if x != nil && x.DoSample != nil { + return *x.DoSample + } + return false +} + +type GenerateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Texts []string `protobuf:"bytes,1,rep,name=texts,proto3" json:"texts,omitempty"` + Scores []float64 `protobuf:"fixed64,2,rep,packed,name=scores,proto3" json:"scores,omitempty"` +} + +func (x *GenerateResponse) Reset() { + *x = GenerateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_textgeneration_v1_texgeneration_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateResponse) ProtoMessage() {} + +func (x *GenerateResponse) ProtoReflect() protoreflect.Message { + mi := &file_textgeneration_v1_texgeneration_proto_msgTypes[2] + 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 GenerateResponse.ProtoReflect.Descriptor instead. +func (*GenerateResponse) Descriptor() ([]byte, []int) { + return file_textgeneration_v1_texgeneration_proto_rawDescGZIP(), []int{2} +} + +func (x *GenerateResponse) GetTexts() []string { + if x != nil { + return x.Texts + } + return nil +} + +func (x *GenerateResponse) GetScores() []float64 { + if x != nil { + return x.Scores + } + return nil +} + +var File_textgeneration_v1_texgeneration_proto protoreflect.FileDescriptor + +var file_textgeneration_v1_texgeneration_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x74, 0x65, 0x78, 0x74, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x78, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x74, 0x65, 0x78, 0x74, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x12, 0x50, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x78, 0x74, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x73, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x18, 0x54, 0x65, 0x78, 0x74, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x18, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x5f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x48, + 0x00, 0x52, 0x04, 0x74, 0x6f, 0x70, 0x4b, 0x88, 0x01, 0x01, 0x12, 0x18, 0x0a, 0x05, 0x74, 0x6f, + 0x70, 0x5f, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x48, 0x01, 0x52, 0x04, 0x74, 0x6f, 0x70, + 0x50, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x48, 0x02, 0x52, 0x0b, 0x74, 0x65, 0x6d, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x64, + 0x6f, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x03, + 0x52, 0x08, 0x64, 0x6f, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x74, 0x6f, 0x70, 0x5f, 0x6b, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x74, 0x6f, 0x70, 0x5f, + 0x70, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x64, 0x6f, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x22, + 0x40, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x65, 0x78, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x65, 0x78, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, + 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x01, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, + 0x73, 0x32, 0x85, 0x01, 0x0a, 0x15, 0x54, 0x65, 0x78, 0x74, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x08, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x74, 0x65, + 0x78, 0x74, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, 0x22, 0x0c, 0x2f, 0x76, 0x31, + 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x42, 0x54, 0x5a, 0x52, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6c, 0x70, 0x6f, 0x64, 0x79, 0x73, 0x73, + 0x65, 0x79, 0x2f, 0x63, 0x79, 0x62, 0x65, 0x72, 0x74, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x65, 0x78, + 0x74, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, + 0x65, 0x78, 0x74, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_textgeneration_v1_texgeneration_proto_rawDescOnce sync.Once + file_textgeneration_v1_texgeneration_proto_rawDescData = file_textgeneration_v1_texgeneration_proto_rawDesc +) + +func file_textgeneration_v1_texgeneration_proto_rawDescGZIP() []byte { + file_textgeneration_v1_texgeneration_proto_rawDescOnce.Do(func() { + file_textgeneration_v1_texgeneration_proto_rawDescData = protoimpl.X.CompressGZIP(file_textgeneration_v1_texgeneration_proto_rawDescData) + }) + return file_textgeneration_v1_texgeneration_proto_rawDescData +} + +var file_textgeneration_v1_texgeneration_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_textgeneration_v1_texgeneration_proto_goTypes = []interface{}{ + (*GenerateRequest)(nil), // 0: textgeneration.v1.GenerateRequest + (*TextGenerationParameters)(nil), // 1: textgeneration.v1.TextGenerationParameters + (*GenerateResponse)(nil), // 2: textgeneration.v1.GenerateResponse +} +var file_textgeneration_v1_texgeneration_proto_depIdxs = []int32{ + 1, // 0: textgeneration.v1.GenerateRequest.parameters:type_name -> textgeneration.v1.TextGenerationParameters + 0, // 1: textgeneration.v1.TextGenerationService.Generate:input_type -> textgeneration.v1.GenerateRequest + 2, // 2: textgeneration.v1.TextGenerationService.Generate:output_type -> textgeneration.v1.GenerateResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_textgeneration_v1_texgeneration_proto_init() } +func file_textgeneration_v1_texgeneration_proto_init() { + if File_textgeneration_v1_texgeneration_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_textgeneration_v1_texgeneration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_textgeneration_v1_texgeneration_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TextGenerationParameters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_textgeneration_v1_texgeneration_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_textgeneration_v1_texgeneration_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_textgeneration_v1_texgeneration_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_textgeneration_v1_texgeneration_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_textgeneration_v1_texgeneration_proto_goTypes, + DependencyIndexes: file_textgeneration_v1_texgeneration_proto_depIdxs, + MessageInfos: file_textgeneration_v1_texgeneration_proto_msgTypes, + }.Build() + File_textgeneration_v1_texgeneration_proto = out.File + file_textgeneration_v1_texgeneration_proto_rawDesc = nil + file_textgeneration_v1_texgeneration_proto_goTypes = nil + file_textgeneration_v1_texgeneration_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.gw.go b/pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.gw.go new file mode 100644 index 0000000..6163f1a --- /dev/null +++ b/pkg/server/gen/proto/go/textgeneration/v1/texgeneration.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: textgeneration/v1/texgeneration.proto + +/* +Package textgenerationv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package textgenerationv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TextGenerationService_Generate_0(ctx context.Context, marshaler runtime.Marshaler, client TextGenerationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GenerateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Generate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TextGenerationService_Generate_0(ctx context.Context, marshaler runtime.Marshaler, server TextGenerationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GenerateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Generate(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTextGenerationServiceHandlerServer registers the http handlers for service TextGenerationService to "mux". +// UnaryRPC :call TextGenerationServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTextGenerationServiceHandlerFromEndpoint instead. +func RegisterTextGenerationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TextGenerationServiceServer) error { + + mux.Handle("POST", pattern_TextGenerationService_Generate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/textgeneration.v1.TextGenerationService/Generate", runtime.WithHTTPPathPattern("/v1/generate")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TextGenerationService_Generate_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TextGenerationService_Generate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTextGenerationServiceHandlerFromEndpoint is same as RegisterTextGenerationServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTextGenerationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTextGenerationServiceHandler(ctx, mux, conn) +} + +// RegisterTextGenerationServiceHandler registers the http handlers for service TextGenerationService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTextGenerationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTextGenerationServiceHandlerClient(ctx, mux, NewTextGenerationServiceClient(conn)) +} + +// RegisterTextGenerationServiceHandlerClient registers the http handlers for service TextGenerationService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TextGenerationServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TextGenerationServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TextGenerationServiceClient" to call the correct interceptors. +func RegisterTextGenerationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TextGenerationServiceClient) error { + + mux.Handle("POST", pattern_TextGenerationService_Generate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/textgeneration.v1.TextGenerationService/Generate", runtime.WithHTTPPathPattern("/v1/generate")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TextGenerationService_Generate_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TextGenerationService_Generate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TextGenerationService_Generate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "generate"}, "")) +) + +var ( + forward_TextGenerationService_Generate_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/textgeneration/v1/texgeneration_grpc.pb.go b/pkg/server/gen/proto/go/textgeneration/v1/texgeneration_grpc.pb.go new file mode 100644 index 0000000..9bac8ce --- /dev/null +++ b/pkg/server/gen/proto/go/textgeneration/v1/texgeneration_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: textgeneration/v1/texgeneration.proto + +package textgenerationv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + TextGenerationService_Generate_FullMethodName = "/textgeneration.v1.TextGenerationService/Generate" +) + +// TextGenerationServiceClient is the client API for TextGenerationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TextGenerationServiceClient interface { + Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) +} + +type textGenerationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTextGenerationServiceClient(cc grpc.ClientConnInterface) TextGenerationServiceClient { + return &textGenerationServiceClient{cc} +} + +func (c *textGenerationServiceClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { + out := new(GenerateResponse) + err := c.cc.Invoke(ctx, TextGenerationService_Generate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TextGenerationServiceServer is the server API for TextGenerationService service. +// All implementations must embed UnimplementedTextGenerationServiceServer +// for forward compatibility +type TextGenerationServiceServer interface { + Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) + mustEmbedUnimplementedTextGenerationServiceServer() +} + +// UnimplementedTextGenerationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTextGenerationServiceServer struct { +} + +func (UnimplementedTextGenerationServiceServer) Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") +} +func (UnimplementedTextGenerationServiceServer) mustEmbedUnimplementedTextGenerationServiceServer() {} + +// UnsafeTextGenerationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TextGenerationServiceServer will +// result in compilation errors. +type UnsafeTextGenerationServiceServer interface { + mustEmbedUnimplementedTextGenerationServiceServer() +} + +func RegisterTextGenerationServiceServer(s grpc.ServiceRegistrar, srv TextGenerationServiceServer) { + s.RegisterService(&TextGenerationService_ServiceDesc, srv) +} + +func _TextGenerationService_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TextGenerationServiceServer).Generate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TextGenerationService_Generate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TextGenerationServiceServer).Generate(ctx, req.(*GenerateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TextGenerationService_ServiceDesc is the grpc.ServiceDesc for TextGenerationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TextGenerationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "textgeneration.v1.TextGenerationService", + HandlerType: (*TextGenerationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Generate", + Handler: _TextGenerationService_Generate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "textgeneration/v1/texgeneration.proto", +} diff --git a/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.go b/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.go new file mode 100644 index 0000000..f2409b9 --- /dev/null +++ b/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.go @@ -0,0 +1,399 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: tokenclassification/v1/tokenclassification.proto + +package tokenclassificationv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ClassifyRequest_AggregationStrategy int32 + +const ( + // Every token gets classified without further aggregation (default) + ClassifyRequest_NONE ClassifyRequest_AggregationStrategy = 0 + // Entities are grouped according to the IOB annotation schema + ClassifyRequest_SIMPLE ClassifyRequest_AggregationStrategy = 1 +) + +// Enum value maps for ClassifyRequest_AggregationStrategy. +var ( + ClassifyRequest_AggregationStrategy_name = map[int32]string{ + 0: "NONE", + 1: "SIMPLE", + } + ClassifyRequest_AggregationStrategy_value = map[string]int32{ + "NONE": 0, + "SIMPLE": 1, + } +) + +func (x ClassifyRequest_AggregationStrategy) Enum() *ClassifyRequest_AggregationStrategy { + p := new(ClassifyRequest_AggregationStrategy) + *p = x + return p +} + +func (x ClassifyRequest_AggregationStrategy) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClassifyRequest_AggregationStrategy) Descriptor() protoreflect.EnumDescriptor { + return file_tokenclassification_v1_tokenclassification_proto_enumTypes[0].Descriptor() +} + +func (ClassifyRequest_AggregationStrategy) Type() protoreflect.EnumType { + return &file_tokenclassification_v1_tokenclassification_proto_enumTypes[0] +} + +func (x ClassifyRequest_AggregationStrategy) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClassifyRequest_AggregationStrategy.Descriptor instead. +func (ClassifyRequest_AggregationStrategy) EnumDescriptor() ([]byte, []int) { + return file_tokenclassification_v1_tokenclassification_proto_rawDescGZIP(), []int{0, 0} +} + +type ClassifyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` + AggregationStrategy ClassifyRequest_AggregationStrategy `protobuf:"varint,2,opt,name=aggregation_strategy,json=aggregationStrategy,proto3,enum=tokenclassification.v1.ClassifyRequest_AggregationStrategy" json:"aggregation_strategy,omitempty"` +} + +func (x *ClassifyRequest) Reset() { + *x = ClassifyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_tokenclassification_v1_tokenclassification_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClassifyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClassifyRequest) ProtoMessage() {} + +func (x *ClassifyRequest) ProtoReflect() protoreflect.Message { + mi := &file_tokenclassification_v1_tokenclassification_proto_msgTypes[0] + 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 ClassifyRequest.ProtoReflect.Descriptor instead. +func (*ClassifyRequest) Descriptor() ([]byte, []int) { + return file_tokenclassification_v1_tokenclassification_proto_rawDescGZIP(), []int{0} +} + +func (x *ClassifyRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +func (x *ClassifyRequest) GetAggregationStrategy() ClassifyRequest_AggregationStrategy { + if x != nil { + return x.AggregationStrategy + } + return ClassifyRequest_NONE +} + +type Token struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` + Start int32 `protobuf:"varint,2,opt,name=start,proto3" json:"start,omitempty"` + End int32 `protobuf:"varint,3,opt,name=end,proto3" json:"end,omitempty"` + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + Score float64 `protobuf:"fixed64,5,opt,name=score,proto3" json:"score,omitempty"` +} + +func (x *Token) Reset() { + *x = Token{} + if protoimpl.UnsafeEnabled { + mi := &file_tokenclassification_v1_tokenclassification_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Token) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Token) ProtoMessage() {} + +func (x *Token) ProtoReflect() protoreflect.Message { + mi := &file_tokenclassification_v1_tokenclassification_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 Token.ProtoReflect.Descriptor instead. +func (*Token) Descriptor() ([]byte, []int) { + return file_tokenclassification_v1_tokenclassification_proto_rawDescGZIP(), []int{1} +} + +func (x *Token) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Token) GetStart() int32 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *Token) GetEnd() int32 { + if x != nil { + return x.End + } + return 0 +} + +func (x *Token) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Token) GetScore() float64 { + if x != nil { + return x.Score + } + return 0 +} + +type ClassifyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tokens []*Token `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` +} + +func (x *ClassifyResponse) Reset() { + *x = ClassifyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_tokenclassification_v1_tokenclassification_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClassifyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClassifyResponse) ProtoMessage() {} + +func (x *ClassifyResponse) ProtoReflect() protoreflect.Message { + mi := &file_tokenclassification_v1_tokenclassification_proto_msgTypes[2] + 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 ClassifyResponse.ProtoReflect.Descriptor instead. +func (*ClassifyResponse) Descriptor() ([]byte, []int) { + return file_tokenclassification_v1_tokenclassification_proto_rawDescGZIP(), []int{2} +} + +func (x *ClassifyResponse) GetTokens() []*Token { + if x != nil { + return x.Tokens + } + return nil +} + +var File_tokenclassification_v1_tokenclassification_proto protoreflect.FileDescriptor + +var file_tokenclassification_v1_tokenclassification_proto_rawDesc = []byte{ + 0x0a, 0x30, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x16, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc4, 0x01, 0x0a, 0x0f, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x12, 0x6e, 0x0a, 0x14, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x3b, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, + 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x13, 0x61, + 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, + 0x67, 0x79, 0x22, 0x2b, 0x0a, 0x13, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, + 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x49, 0x4d, 0x50, 0x4c, 0x45, 0x10, 0x01, 0x22, + 0x6f, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x65, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, + 0x22, 0x49, 0x0a, 0x10, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x32, 0x94, 0x01, 0x0a, 0x1a, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x08, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x12, 0x27, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x28, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x11, 0x3a, 0x01, 0x2a, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, + 0x66, 0x79, 0x42, 0x5e, 0x5a, 0x5c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x6c, 0x70, 0x6f, 0x64, 0x79, 0x73, 0x73, 0x65, 0x79, 0x2f, 0x63, 0x79, 0x62, 0x65, + 0x72, 0x74, 0x72, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_tokenclassification_v1_tokenclassification_proto_rawDescOnce sync.Once + file_tokenclassification_v1_tokenclassification_proto_rawDescData = file_tokenclassification_v1_tokenclassification_proto_rawDesc +) + +func file_tokenclassification_v1_tokenclassification_proto_rawDescGZIP() []byte { + file_tokenclassification_v1_tokenclassification_proto_rawDescOnce.Do(func() { + file_tokenclassification_v1_tokenclassification_proto_rawDescData = protoimpl.X.CompressGZIP(file_tokenclassification_v1_tokenclassification_proto_rawDescData) + }) + return file_tokenclassification_v1_tokenclassification_proto_rawDescData +} + +var file_tokenclassification_v1_tokenclassification_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_tokenclassification_v1_tokenclassification_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_tokenclassification_v1_tokenclassification_proto_goTypes = []interface{}{ + (ClassifyRequest_AggregationStrategy)(0), // 0: tokenclassification.v1.ClassifyRequest.AggregationStrategy + (*ClassifyRequest)(nil), // 1: tokenclassification.v1.ClassifyRequest + (*Token)(nil), // 2: tokenclassification.v1.Token + (*ClassifyResponse)(nil), // 3: tokenclassification.v1.ClassifyResponse +} +var file_tokenclassification_v1_tokenclassification_proto_depIdxs = []int32{ + 0, // 0: tokenclassification.v1.ClassifyRequest.aggregation_strategy:type_name -> tokenclassification.v1.ClassifyRequest.AggregationStrategy + 2, // 1: tokenclassification.v1.ClassifyResponse.tokens:type_name -> tokenclassification.v1.Token + 1, // 2: tokenclassification.v1.TokenClassificationService.Classify:input_type -> tokenclassification.v1.ClassifyRequest + 3, // 3: tokenclassification.v1.TokenClassificationService.Classify:output_type -> tokenclassification.v1.ClassifyResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_tokenclassification_v1_tokenclassification_proto_init() } +func file_tokenclassification_v1_tokenclassification_proto_init() { + if File_tokenclassification_v1_tokenclassification_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_tokenclassification_v1_tokenclassification_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClassifyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tokenclassification_v1_tokenclassification_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Token); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_tokenclassification_v1_tokenclassification_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClassifyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_tokenclassification_v1_tokenclassification_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_tokenclassification_v1_tokenclassification_proto_goTypes, + DependencyIndexes: file_tokenclassification_v1_tokenclassification_proto_depIdxs, + EnumInfos: file_tokenclassification_v1_tokenclassification_proto_enumTypes, + MessageInfos: file_tokenclassification_v1_tokenclassification_proto_msgTypes, + }.Build() + File_tokenclassification_v1_tokenclassification_proto = out.File + file_tokenclassification_v1_tokenclassification_proto_rawDesc = nil + file_tokenclassification_v1_tokenclassification_proto_goTypes = nil + file_tokenclassification_v1_tokenclassification_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.gw.go b/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.gw.go new file mode 100644 index 0000000..d01c915 --- /dev/null +++ b/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: tokenclassification/v1/tokenclassification.proto + +/* +Package tokenclassificationv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package tokenclassificationv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TokenClassificationService_Classify_0(ctx context.Context, marshaler runtime.Marshaler, client TokenClassificationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ClassifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Classify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TokenClassificationService_Classify_0(ctx context.Context, marshaler runtime.Marshaler, server TokenClassificationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ClassifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Classify(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTokenClassificationServiceHandlerServer registers the http handlers for service TokenClassificationService to "mux". +// UnaryRPC :call TokenClassificationServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTokenClassificationServiceHandlerFromEndpoint instead. +func RegisterTokenClassificationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TokenClassificationServiceServer) error { + + mux.Handle("POST", pattern_TokenClassificationService_Classify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/tokenclassification.v1.TokenClassificationService/Classify", runtime.WithHTTPPathPattern("/v1/classify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TokenClassificationService_Classify_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TokenClassificationService_Classify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTokenClassificationServiceHandlerFromEndpoint is same as RegisterTokenClassificationServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTokenClassificationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTokenClassificationServiceHandler(ctx, mux, conn) +} + +// RegisterTokenClassificationServiceHandler registers the http handlers for service TokenClassificationService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTokenClassificationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTokenClassificationServiceHandlerClient(ctx, mux, NewTokenClassificationServiceClient(conn)) +} + +// RegisterTokenClassificationServiceHandlerClient registers the http handlers for service TokenClassificationService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TokenClassificationServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TokenClassificationServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TokenClassificationServiceClient" to call the correct interceptors. +func RegisterTokenClassificationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TokenClassificationServiceClient) error { + + mux.Handle("POST", pattern_TokenClassificationService_Classify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/tokenclassification.v1.TokenClassificationService/Classify", runtime.WithHTTPPathPattern("/v1/classify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TokenClassificationService_Classify_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_TokenClassificationService_Classify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TokenClassificationService_Classify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "classify"}, "")) +) + +var ( + forward_TokenClassificationService_Classify_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification_grpc.pb.go b/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification_grpc.pb.go new file mode 100644 index 0000000..835d1d4 --- /dev/null +++ b/pkg/server/gen/proto/go/tokenclassification/v1/tokenclassification_grpc.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: tokenclassification/v1/tokenclassification.proto + +package tokenclassificationv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + TokenClassificationService_Classify_FullMethodName = "/tokenclassification.v1.TokenClassificationService/Classify" +) + +// TokenClassificationServiceClient is the client API for TokenClassificationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TokenClassificationServiceClient interface { + Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error) +} + +type tokenClassificationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTokenClassificationServiceClient(cc grpc.ClientConnInterface) TokenClassificationServiceClient { + return &tokenClassificationServiceClient{cc} +} + +func (c *tokenClassificationServiceClient) Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error) { + out := new(ClassifyResponse) + err := c.cc.Invoke(ctx, TokenClassificationService_Classify_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TokenClassificationServiceServer is the server API for TokenClassificationService service. +// All implementations must embed UnimplementedTokenClassificationServiceServer +// for forward compatibility +type TokenClassificationServiceServer interface { + Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error) + mustEmbedUnimplementedTokenClassificationServiceServer() +} + +// UnimplementedTokenClassificationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTokenClassificationServiceServer struct { +} + +func (UnimplementedTokenClassificationServiceServer) Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Classify not implemented") +} +func (UnimplementedTokenClassificationServiceServer) mustEmbedUnimplementedTokenClassificationServiceServer() { +} + +// UnsafeTokenClassificationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TokenClassificationServiceServer will +// result in compilation errors. +type UnsafeTokenClassificationServiceServer interface { + mustEmbedUnimplementedTokenClassificationServiceServer() +} + +func RegisterTokenClassificationServiceServer(s grpc.ServiceRegistrar, srv TokenClassificationServiceServer) { + s.RegisterService(&TokenClassificationService_ServiceDesc, srv) +} + +func _TokenClassificationService_Classify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClassifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TokenClassificationServiceServer).Classify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: TokenClassificationService_Classify_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TokenClassificationServiceServer).Classify(ctx, req.(*ClassifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TokenClassificationService_ServiceDesc is the grpc.ServiceDesc for TokenClassificationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TokenClassificationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "tokenclassification.v1.TokenClassificationService", + HandlerType: (*TokenClassificationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Classify", + Handler: _TokenClassificationService_Classify_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "tokenclassification/v1/tokenclassification.proto", +} diff --git a/pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.go b/pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.go new file mode 100644 index 0000000..61a0ed8 --- /dev/null +++ b/pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.go @@ -0,0 +1,330 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: zeroshot/v1/zeroshot.proto + +package zeroshotv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ClassifyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` + Parameters *ZeroShotParameters `protobuf:"bytes,2,opt,name=parameters,proto3" json:"parameters,omitempty"` +} + +func (x *ClassifyRequest) Reset() { + *x = ClassifyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_zeroshot_v1_zeroshot_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClassifyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClassifyRequest) ProtoMessage() {} + +func (x *ClassifyRequest) ProtoReflect() protoreflect.Message { + mi := &file_zeroshot_v1_zeroshot_proto_msgTypes[0] + 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 ClassifyRequest.ProtoReflect.Descriptor instead. +func (*ClassifyRequest) Descriptor() ([]byte, []int) { + return file_zeroshot_v1_zeroshot_proto_rawDescGZIP(), []int{0} +} + +func (x *ClassifyRequest) GetInput() string { + if x != nil { + return x.Input + } + return "" +} + +func (x *ClassifyRequest) GetParameters() *ZeroShotParameters { + if x != nil { + return x.Parameters + } + return nil +} + +type ZeroShotParameters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HypothesisTemplate string `protobuf:"bytes,1,opt,name=hypothesis_template,json=hypothesisTemplate,proto3" json:"hypothesis_template,omitempty"` + CandidateLabels []string `protobuf:"bytes,2,rep,name=candidate_labels,json=candidateLabels,proto3" json:"candidate_labels,omitempty"` + MultiLabel bool `protobuf:"varint,3,opt,name=multi_label,json=multiLabel,proto3" json:"multi_label,omitempty"` +} + +func (x *ZeroShotParameters) Reset() { + *x = ZeroShotParameters{} + if protoimpl.UnsafeEnabled { + mi := &file_zeroshot_v1_zeroshot_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ZeroShotParameters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ZeroShotParameters) ProtoMessage() {} + +func (x *ZeroShotParameters) ProtoReflect() protoreflect.Message { + mi := &file_zeroshot_v1_zeroshot_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 ZeroShotParameters.ProtoReflect.Descriptor instead. +func (*ZeroShotParameters) Descriptor() ([]byte, []int) { + return file_zeroshot_v1_zeroshot_proto_rawDescGZIP(), []int{1} +} + +func (x *ZeroShotParameters) GetHypothesisTemplate() string { + if x != nil { + return x.HypothesisTemplate + } + return "" +} + +func (x *ZeroShotParameters) GetCandidateLabels() []string { + if x != nil { + return x.CandidateLabels + } + return nil +} + +func (x *ZeroShotParameters) GetMultiLabel() bool { + if x != nil { + return x.MultiLabel + } + return false +} + +type ClassifyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // TODO: string sequence = ...; ? + Labels []string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"` + Scores []float64 `protobuf:"fixed64,2,rep,packed,name=scores,proto3" json:"scores,omitempty"` +} + +func (x *ClassifyResponse) Reset() { + *x = ClassifyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_zeroshot_v1_zeroshot_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClassifyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClassifyResponse) ProtoMessage() {} + +func (x *ClassifyResponse) ProtoReflect() protoreflect.Message { + mi := &file_zeroshot_v1_zeroshot_proto_msgTypes[2] + 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 ClassifyResponse.ProtoReflect.Descriptor instead. +func (*ClassifyResponse) Descriptor() ([]byte, []int) { + return file_zeroshot_v1_zeroshot_proto_rawDescGZIP(), []int{2} +} + +func (x *ClassifyResponse) GetLabels() []string { + if x != nil { + return x.Labels + } + return nil +} + +func (x *ClassifyResponse) GetScores() []float64 { + if x != nil { + return x.Scores + } + return nil +} + +var File_zeroshot_v1_zeroshot_proto protoreflect.FileDescriptor + +var file_zeroshot_v1_zeroshot_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x7a, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x7a, 0x65, + 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x7a, 0x65, + 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x68, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, + 0x12, 0x3f, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x5a, 0x65, 0x72, 0x6f, 0x53, 0x68, 0x6f, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x22, 0x91, 0x01, 0x0a, 0x12, 0x5a, 0x65, 0x72, 0x6f, 0x53, 0x68, 0x6f, 0x74, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x68, 0x79, 0x70, 0x6f, + 0x74, 0x68, 0x65, 0x73, 0x69, 0x73, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x68, 0x79, 0x70, 0x6f, 0x74, 0x68, 0x65, 0x73, 0x69, + 0x73, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x61, 0x6e, + 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x61, + 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x6c, 0x61, + 0x62, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0x42, 0x0a, 0x10, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x01, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x32, 0x73, 0x0a, 0x0f, 0x5a, 0x65, 0x72, + 0x6f, 0x53, 0x68, 0x6f, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x08, + 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x12, 0x1c, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x73, + 0x68, 0x6f, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x7a, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x3a, 0x01, 0x2a, + 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x69, 0x66, 0x79, 0x42, 0x48, + 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6c, 0x70, + 0x6f, 0x64, 0x79, 0x73, 0x73, 0x65, 0x79, 0x2f, 0x63, 0x79, 0x62, 0x65, 0x72, 0x74, 0x72, 0x6f, + 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x73, 0x2f, 0x7a, 0x65, 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x7a, 0x65, + 0x72, 0x6f, 0x73, 0x68, 0x6f, 0x74, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_zeroshot_v1_zeroshot_proto_rawDescOnce sync.Once + file_zeroshot_v1_zeroshot_proto_rawDescData = file_zeroshot_v1_zeroshot_proto_rawDesc +) + +func file_zeroshot_v1_zeroshot_proto_rawDescGZIP() []byte { + file_zeroshot_v1_zeroshot_proto_rawDescOnce.Do(func() { + file_zeroshot_v1_zeroshot_proto_rawDescData = protoimpl.X.CompressGZIP(file_zeroshot_v1_zeroshot_proto_rawDescData) + }) + return file_zeroshot_v1_zeroshot_proto_rawDescData +} + +var file_zeroshot_v1_zeroshot_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_zeroshot_v1_zeroshot_proto_goTypes = []interface{}{ + (*ClassifyRequest)(nil), // 0: zeroshot.v1.ClassifyRequest + (*ZeroShotParameters)(nil), // 1: zeroshot.v1.ZeroShotParameters + (*ClassifyResponse)(nil), // 2: zeroshot.v1.ClassifyResponse +} +var file_zeroshot_v1_zeroshot_proto_depIdxs = []int32{ + 1, // 0: zeroshot.v1.ClassifyRequest.parameters:type_name -> zeroshot.v1.ZeroShotParameters + 0, // 1: zeroshot.v1.ZeroShotService.Classify:input_type -> zeroshot.v1.ClassifyRequest + 2, // 2: zeroshot.v1.ZeroShotService.Classify:output_type -> zeroshot.v1.ClassifyResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_zeroshot_v1_zeroshot_proto_init() } +func file_zeroshot_v1_zeroshot_proto_init() { + if File_zeroshot_v1_zeroshot_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_zeroshot_v1_zeroshot_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClassifyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_zeroshot_v1_zeroshot_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ZeroShotParameters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_zeroshot_v1_zeroshot_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClassifyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_zeroshot_v1_zeroshot_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_zeroshot_v1_zeroshot_proto_goTypes, + DependencyIndexes: file_zeroshot_v1_zeroshot_proto_depIdxs, + MessageInfos: file_zeroshot_v1_zeroshot_proto_msgTypes, + }.Build() + File_zeroshot_v1_zeroshot_proto = out.File + file_zeroshot_v1_zeroshot_proto_rawDesc = nil + file_zeroshot_v1_zeroshot_proto_goTypes = nil + file_zeroshot_v1_zeroshot_proto_depIdxs = nil +} diff --git a/pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.gw.go b/pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.gw.go new file mode 100644 index 0000000..ce7c292 --- /dev/null +++ b/pkg/server/gen/proto/go/zeroshot/v1/zeroshot.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: zeroshot/v1/zeroshot.proto + +/* +Package zeroshotv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package zeroshotv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_ZeroShotService_Classify_0(ctx context.Context, marshaler runtime.Marshaler, client ZeroShotServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ClassifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Classify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ZeroShotService_Classify_0(ctx context.Context, marshaler runtime.Marshaler, server ZeroShotServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ClassifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Classify(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterZeroShotServiceHandlerServer registers the http handlers for service ZeroShotService to "mux". +// UnaryRPC :call ZeroShotServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterZeroShotServiceHandlerFromEndpoint instead. +func RegisterZeroShotServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ZeroShotServiceServer) error { + + mux.Handle("POST", pattern_ZeroShotService_Classify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/zeroshot.v1.ZeroShotService/Classify", runtime.WithHTTPPathPattern("/v1/classify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ZeroShotService_Classify_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ZeroShotService_Classify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterZeroShotServiceHandlerFromEndpoint is same as RegisterZeroShotServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterZeroShotServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterZeroShotServiceHandler(ctx, mux, conn) +} + +// RegisterZeroShotServiceHandler registers the http handlers for service ZeroShotService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterZeroShotServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterZeroShotServiceHandlerClient(ctx, mux, NewZeroShotServiceClient(conn)) +} + +// RegisterZeroShotServiceHandlerClient registers the http handlers for service ZeroShotService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ZeroShotServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ZeroShotServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "ZeroShotServiceClient" to call the correct interceptors. +func RegisterZeroShotServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ZeroShotServiceClient) error { + + mux.Handle("POST", pattern_ZeroShotService_Classify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/zeroshot.v1.ZeroShotService/Classify", runtime.WithHTTPPathPattern("/v1/classify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ZeroShotService_Classify_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_ZeroShotService_Classify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_ZeroShotService_Classify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "classify"}, "")) +) + +var ( + forward_ZeroShotService_Classify_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/server/gen/proto/go/zeroshot/v1/zeroshot_grpc.pb.go b/pkg/server/gen/proto/go/zeroshot/v1/zeroshot_grpc.pb.go new file mode 100644 index 0000000..b06d987 --- /dev/null +++ b/pkg/server/gen/proto/go/zeroshot/v1/zeroshot_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: zeroshot/v1/zeroshot.proto + +package zeroshotv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + ZeroShotService_Classify_FullMethodName = "/zeroshot.v1.ZeroShotService/Classify" +) + +// ZeroShotServiceClient is the client API for ZeroShotService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ZeroShotServiceClient interface { + Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error) +} + +type zeroShotServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewZeroShotServiceClient(cc grpc.ClientConnInterface) ZeroShotServiceClient { + return &zeroShotServiceClient{cc} +} + +func (c *zeroShotServiceClient) Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error) { + out := new(ClassifyResponse) + err := c.cc.Invoke(ctx, ZeroShotService_Classify_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ZeroShotServiceServer is the server API for ZeroShotService service. +// All implementations must embed UnimplementedZeroShotServiceServer +// for forward compatibility +type ZeroShotServiceServer interface { + Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error) + mustEmbedUnimplementedZeroShotServiceServer() +} + +// UnimplementedZeroShotServiceServer must be embedded to have forward compatible implementations. +type UnimplementedZeroShotServiceServer struct { +} + +func (UnimplementedZeroShotServiceServer) Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Classify not implemented") +} +func (UnimplementedZeroShotServiceServer) mustEmbedUnimplementedZeroShotServiceServer() {} + +// UnsafeZeroShotServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ZeroShotServiceServer will +// result in compilation errors. +type UnsafeZeroShotServiceServer interface { + mustEmbedUnimplementedZeroShotServiceServer() +} + +func RegisterZeroShotServiceServer(s grpc.ServiceRegistrar, srv ZeroShotServiceServer) { + s.RegisterService(&ZeroShotService_ServiceDesc, srv) +} + +func _ZeroShotService_Classify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClassifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ZeroShotServiceServer).Classify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ZeroShotService_Classify_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ZeroShotServiceServer).Classify(ctx, req.(*ClassifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ZeroShotService_ServiceDesc is the grpc.ServiceDesc for ZeroShotService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ZeroShotService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "zeroshot.v1.ZeroShotService", + HandlerType: (*ZeroShotServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Classify", + Handler: _ZeroShotService_Classify_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "zeroshot/v1/zeroshot.proto", +}