diff --git a/Makefile b/Makefile index 330d669..12ee177 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ default: build -build: build-backend +build: build-protos build-backend .PHONY: build build-backend: sh -c "cd ./backend && make all" -.PHONY: build-backend \ No newline at end of file +.PHONY: build-backend + +build-protos: + sh -c "cd ./protos && make all" +.PHONY: build-protos \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e303762 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +## Introduction +[Missing studio](https://www.missing.studio) is a robust open source platform to build a developer-first way to create +AI application using LLM, Image, Audio and Video Studios. + + +## Features +- 🌐 *Universal API* - Call every LLM API like it's OpenAI +- *AI Gateway* for rate limit, atomatic retries, caching, failover etc +- Workflow builder to compose complex AI apps +- AI Agents +- LLM Studio to bring LLM applications to production +- Image studio +- Audio studio +- Video studio +- Storage to connect with providers like s3, gcs, vector DBs etc. +- Inference and serving to serve AI/ML models in production +- Finetune models +- Model Deployment at Scale on Kubernetes 🦄️ +- Dev tools – all missing studio dev tools (CLI, SDK, API Client) \ No newline at end of file diff --git a/backend/Makefile b/backend/Makefile index 8f6cd9d..553de01 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -6,22 +6,22 @@ all: build vet: $(GO) vet ./... -build: vet +build: gen vet scripts/build.sh .PHONY: build -dbuild: vet +dbuild: gen vet GOOS=linux scripts/build.sh .PHONY: dbuild -run: - ./bin/mgmt serve connect -.PHONY: run - # build-debug: # CGO_ENABLED=0 $(GO) build -gcflags="all=-N -l" -o bin/mgmt cmd/mgmt/*.go # .PHONY: build-debug +gen: + sh -c "cd ../protos && make all" +.PHONY: gen + clean: rm -rf bin .PHONY: clean diff --git a/backend/go.mod b/backend/go.mod index c7e81d6..7591cb2 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -2,11 +2,14 @@ module github.com/missingstudio/studio/backend go 1.21.5 +replace github.com/missingstudio/studio/protos => ../protos + require ( connectrpc.com/connect v1.14.0 connectrpc.com/grpchealth v1.3.0 connectrpc.com/grpcreflect v1.2.0 connectrpc.com/validate v0.1.0 + github.com/missingstudio/studio/protos v0.0.0-00010101000000-000000000000 github.com/rs/cors v1.10.1 github.com/stretchr/testify v1.8.4 github.com/zeebo/assert v1.3.1 @@ -19,11 +22,13 @@ require ( github.com/bufbuild/protovalidate-go v0.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/cel-go v0.17.4 // indirect - github.com/missingstudio/protos v0.0.0-20240118094218-a89cc79e77c2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/protobuf v1.32.0 // indirect diff --git a/backend/go.sum b/backend/go.sum index 51d7b31..10443fd 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -21,18 +21,18 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/google/cel-go v0.17.4 h1:9556LOjSyIZlgnT0oaCYGq2uk9BM6fzuTXhzYHskonk= github.com/google/cel-go v0.17.4/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/missingstudio/protos v0.0.0-20240117082200-e7d28f6e1b95 h1:HU8E6CgVslGooBuuKGtocy3NMz3bScv96HEGFZT6Umg= -github.com/missingstudio/protos v0.0.0-20240117082200-e7d28f6e1b95/go.mod h1:NhgmLsBUuSD/N9PeohnGbftWgUPTmjWHTzgU4yA+414= -github.com/missingstudio/protos v0.0.0-20240118094218-a89cc79e77c2 h1:kf22kKJa/fY7fE60lFotRwq1Qwn1ETe9Y3h9ceNpTu4= -github.com/missingstudio/protos v0.0.0-20240118094218-a89cc79e77c2/go.mod h1:TrD8riaWSVps9L5iZFLc6XAa4zEYJQVBOcNDbFBEYSs= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= @@ -54,19 +54,19 @@ golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/internal/connectrpc/mux.go b/backend/internal/connectrpc/mux.go index f3b244d..2f6daae 100644 --- a/backend/internal/connectrpc/mux.go +++ b/backend/internal/connectrpc/mux.go @@ -10,8 +10,8 @@ import ( "connectrpc.com/grpchealth" "connectrpc.com/grpcreflect" "connectrpc.com/validate" - greetingv1 "github.com/missingstudio/protos/pkg/greeting/v1" - "github.com/missingstudio/protos/pkg/greeting/v1/greetingv1connect" + greetingv1 "github.com/missingstudio/studio/protos/pkg/greeting/v1" + "github.com/missingstudio/studio/protos/pkg/greeting/v1/greetingv1connect" ) type Deps struct{} diff --git a/backend/main_test.go b/backend/main_test.go index b5f6975..54bbf0d 100644 --- a/backend/main_test.go +++ b/backend/main_test.go @@ -8,9 +8,9 @@ import ( "connectrpc.com/connect" - greetingv1 "github.com/missingstudio/protos/pkg/greeting/v1" - "github.com/missingstudio/protos/pkg/greeting/v1/greetingv1connect" "github.com/missingstudio/studio/backend/internal/connectrpc" + greetingv1 "github.com/missingstudio/studio/protos/pkg/greeting/v1" + "github.com/missingstudio/studio/protos/pkg/greeting/v1/greetingv1connect" "github.com/stretchr/testify/require" "github.com/zeebo/assert" diff --git a/go.work b/go.work index e5e049d..3198cbf 100644 --- a/go.work +++ b/go.work @@ -4,4 +4,5 @@ use ( ./backend ./cli ./worker + ./protos ) diff --git a/protos/.gitignore b/protos/.gitignore new file mode 100644 index 0000000..618a2d5 --- /dev/null +++ b/protos/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +/target +.vscode/ +/obj +/bin \ No newline at end of file diff --git a/protos/Makefile b/protos/Makefile new file mode 100644 index 0000000..7d3a8a4 --- /dev/null +++ b/protos/Makefile @@ -0,0 +1,7 @@ +default: all + +all: build + +build: + buf generate proto +.PHONY: build \ No newline at end of file diff --git a/protos/README.md b/protos/README.md new file mode 100644 index 0000000..ed33976 --- /dev/null +++ b/protos/README.md @@ -0,0 +1,12 @@ +## Protos +For protobuf based API development. Buf will take care of protobuf generation for each language. + - Buf modules + - Buf plugins + +### Basic + 1. buf mod init + 2. buf mod update + 3. buf build + 4. buf generate proto + 5. buf lint proto + 6. buf curl --schema proto http://localhost:8080/missingstudio.v1.PingService/Ping \ No newline at end of file diff --git a/protos/buf.gen.yaml b/protos/buf.gen.yaml new file mode 100644 index 0000000..0e210af --- /dev/null +++ b/protos/buf.gen.yaml @@ -0,0 +1,32 @@ +version: v1 +managed: + enabled: true + go_package_prefix: + default: github.com/missingstudio/studio/protos/pkg + except: + - buf.build/googleapis/googleapis + - buf.build/bufbuild/protovalidate + - buf.build/grpc-ecosystem/grpc-gateway + +plugins: + # Go Plugins + - plugin: buf.build/connectrpc/go:v1.14.0 + out: pkg + opt: paths=source_relative + + - plugin: buf.build/protocolbuffers/go:v1.32.0 + out: pkg + opt: paths=source_relative + + # Typescript plugins + - plugin: buf.build/bufbuild/es:v1.6.0 + opt: + - target=ts + - import_extension= + out: src + + - plugin: buf.build/connectrpc/es:v1.2.0 + opt: + - target=ts + - import_extension= + out: src \ No newline at end of file diff --git a/protos/buf.work.yaml b/protos/buf.work.yaml new file mode 100644 index 0000000..7a18eb0 --- /dev/null +++ b/protos/buf.work.yaml @@ -0,0 +1,3 @@ +version: v1 +directories: + - proto \ No newline at end of file diff --git a/protos/go.mod b/protos/go.mod new file mode 100644 index 0000000..bc339a9 --- /dev/null +++ b/protos/go.mod @@ -0,0 +1,17 @@ +module github.com/missingstudio/studio/protos + +go 1.21.5 + +require ( + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230824200731-b9b8148056b9.1 + connectrpc.com/connect v1.14.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 + google.golang.org/protobuf v1.32.0 +) + +require ( + golang.org/x/net v0.20.0 // indirect + google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect +) diff --git a/protos/go.sum b/protos/go.sum new file mode 100644 index 0000000..d14e0d1 --- /dev/null +++ b/protos/go.sum @@ -0,0 +1,25 @@ +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230824200731-b9b8148056b9.1 h1:9Ea7lsYYvoyqmq79GbCy6POXHrZbC+pHs+6lGNx9IBQ= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20230824200731-b9b8148056b9.1/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew= +connectrpc.com/connect v1.14.0 h1:PDS+J7uoz5Oui2VEOMcfz6Qft7opQM9hPiKvtGC01pA= +connectrpc.com/connect v1.14.0/go.mod h1:uoAq5bmhhn43TwhaKdGKN/bZcGtzPW1v+ngDTn5u+8s= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/protos/pkg/greeting/v1/greetingv1connect/service.connect.go b/protos/pkg/greeting/v1/greetingv1connect/service.connect.go new file mode 100644 index 0000000..a7bd467 --- /dev/null +++ b/protos/pkg/greeting/v1/greetingv1connect/service.connect.go @@ -0,0 +1,112 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: greeting/v1/service.proto + +package greetingv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/missingstudio/studio/protos/pkg/greeting/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // GreetServiceName is the fully-qualified name of the GreetService service. + GreetServiceName = "greeting.v1.GreetService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // GreetServiceGreetProcedure is the fully-qualified name of the GreetService's Greet RPC. + GreetServiceGreetProcedure = "/greeting.v1.GreetService/Greet" +) + +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + greetServiceServiceDescriptor = v1.File_greeting_v1_service_proto.Services().ByName("GreetService") + greetServiceGreetMethodDescriptor = greetServiceServiceDescriptor.Methods().ByName("Greet") +) + +// GreetServiceClient is a client for the greeting.v1.GreetService service. +type GreetServiceClient interface { + Greet(context.Context, *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error) +} + +// NewGreetServiceClient constructs a client for the greeting.v1.GreetService service. By default, +// it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and +// sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() +// or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewGreetServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GreetServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &greetServiceClient{ + greet: connect.NewClient[v1.GreetRequest, v1.GreetResponse]( + httpClient, + baseURL+GreetServiceGreetProcedure, + connect.WithSchema(greetServiceGreetMethodDescriptor), + connect.WithClientOptions(opts...), + ), + } +} + +// greetServiceClient implements GreetServiceClient. +type greetServiceClient struct { + greet *connect.Client[v1.GreetRequest, v1.GreetResponse] +} + +// Greet calls greeting.v1.GreetService.Greet. +func (c *greetServiceClient) Greet(ctx context.Context, req *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error) { + return c.greet.CallUnary(ctx, req) +} + +// GreetServiceHandler is an implementation of the greeting.v1.GreetService service. +type GreetServiceHandler interface { + Greet(context.Context, *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error) +} + +// NewGreetServiceHandler builds an HTTP handler from the service implementation. It returns the +// path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewGreetServiceHandler(svc GreetServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + greetServiceGreetHandler := connect.NewUnaryHandler( + GreetServiceGreetProcedure, + svc.Greet, + connect.WithSchema(greetServiceGreetMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + return "/greeting.v1.GreetService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case GreetServiceGreetProcedure: + greetServiceGreetHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedGreetServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedGreetServiceHandler struct{} + +func (UnimplementedGreetServiceHandler) Greet(context.Context, *connect.Request[v1.GreetRequest]) (*connect.Response[v1.GreetResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("greeting.v1.GreetService.Greet is not implemented")) +} diff --git a/protos/pkg/greeting/v1/service.pb.go b/protos/pkg/greeting/v1/service.pb.go new file mode 100644 index 0000000..eb32aed --- /dev/null +++ b/protos/pkg/greeting/v1/service.pb.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc (unknown) +// source: greeting/v1/service.proto + +package greetingv1 + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + _ "google.golang.org/genproto/googleapis/rpc/errdetails" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/known/emptypb" + 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 GreetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GreetRequest) Reset() { + *x = GreetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_greeting_v1_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GreetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GreetRequest) ProtoMessage() {} + +func (x *GreetRequest) ProtoReflect() protoreflect.Message { + mi := &file_greeting_v1_service_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 GreetRequest.ProtoReflect.Descriptor instead. +func (*GreetRequest) Descriptor() ([]byte, []int) { + return file_greeting_v1_service_proto_rawDescGZIP(), []int{0} +} + +func (x *GreetRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GreetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"` +} + +func (x *GreetResponse) Reset() { + *x = GreetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_greeting_v1_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GreetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GreetResponse) ProtoMessage() {} + +func (x *GreetResponse) ProtoReflect() protoreflect.Message { + mi := &file_greeting_v1_service_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 GreetResponse.ProtoReflect.Descriptor instead. +func (*GreetResponse) Descriptor() ([]byte, []int) { + return file_greeting_v1_service_proto_rawDescGZIP(), []int{1} +} + +func (x *GreetResponse) GetGreeting() string { + if x != nil { + return x.Greeting + } + return "" +} + +var File_greeting_v1_service_proto protoreflect.FileDescriptor + +var file_greeting_v1_service_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x67, 0x72, 0x65, + 0x65, 0x74, 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, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x64, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x0c, + 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xba, 0x48, 0x04, 0x72, + 0x02, 0x10, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d, 0x47, 0x72, 0x65, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, + 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, + 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xb2, 0x04, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa1, 0x04, 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, + 0x74, 0x12, 0x19, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, + 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe0, 0x03, 0x92, 0x41, 0xcb, 0x03, 0x4a, + 0x39, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x32, 0x0a, 0x18, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x73, 0x20, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x16, 0x0a, 0x14, 0x1a, 0x12, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x4a, 0x64, 0x0a, 0x03, 0x34, 0x30, + 0x30, 0x12, 0x5d, 0x0a, 0x3f, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x73, 0x20, 0x64, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x74, 0x65, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x77, 0x68, 0x79, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x77, 0x61, 0x73, + 0x20, 0x62, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x18, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x42, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x4a, 0x5b, 0x0a, 0x03, 0x34, 0x30, 0x31, 0x12, 0x54, 0x0a, 0x37, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x74, 0x65, 0x6c, 0x6c, + 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x68, 0x65, 0x20, + 0x69, 0x73, 0x20, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x12, 0x19, 0x0a, 0x17, 0x1a, 0x15, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x4a, 0x7b, 0x0a, + 0x03, 0x34, 0x30, 0x33, 0x12, 0x74, 0x0a, 0x57, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x73, + 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x20, 0x74, 0x65, 0x6c, 0x6c, 0x69, 0x6e, 0x67, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x68, 0x65, 0x20, 0x69, 0x73, 0x20, + 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, + 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x19, 0x0a, 0x17, 0x1a, 0x15, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x4a, 0x4e, 0x0a, 0x03, 0x34, 0x30, + 0x34, 0x12, 0x47, 0x0a, 0x2a, 0x54, 0x65, 0x6c, 0x6c, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x75, + 0x6c, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x12, + 0x19, 0x0a, 0x17, 0x1a, 0x15, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, + 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x72, 0x65, 0x65, 0x74, 0x42, 0xaf, 0x01, 0x0a, 0x0f, + 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x42, + 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6e, 0x67, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2f, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x65, 0x65, + 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, + 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x47, 0x72, 0x65, 0x65, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0b, 0x47, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, + 0x67, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x17, 0x47, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x5c, + 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_greeting_v1_service_proto_rawDescOnce sync.Once + file_greeting_v1_service_proto_rawDescData = file_greeting_v1_service_proto_rawDesc +) + +func file_greeting_v1_service_proto_rawDescGZIP() []byte { + file_greeting_v1_service_proto_rawDescOnce.Do(func() { + file_greeting_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_greeting_v1_service_proto_rawDescData) + }) + return file_greeting_v1_service_proto_rawDescData +} + +var file_greeting_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_greeting_v1_service_proto_goTypes = []interface{}{ + (*GreetRequest)(nil), // 0: greeting.v1.GreetRequest + (*GreetResponse)(nil), // 1: greeting.v1.GreetResponse +} +var file_greeting_v1_service_proto_depIdxs = []int32{ + 0, // 0: greeting.v1.GreetService.Greet:input_type -> greeting.v1.GreetRequest + 1, // 1: greeting.v1.GreetService.Greet:output_type -> greeting.v1.GreetResponse + 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_greeting_v1_service_proto_init() } +func file_greeting_v1_service_proto_init() { + if File_greeting_v1_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_greeting_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GreetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greeting_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GreetResponse); 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_greeting_v1_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_greeting_v1_service_proto_goTypes, + DependencyIndexes: file_greeting_v1_service_proto_depIdxs, + MessageInfos: file_greeting_v1_service_proto_msgTypes, + }.Build() + File_greeting_v1_service_proto = out.File + file_greeting_v1_service_proto_rawDesc = nil + file_greeting_v1_service_proto_goTypes = nil + file_greeting_v1_service_proto_depIdxs = nil +} diff --git a/protos/pkg/llm/llmv1beta1connect/service.connect.go b/protos/pkg/llm/llmv1beta1connect/service.connect.go new file mode 100644 index 0000000..7a9394f --- /dev/null +++ b/protos/pkg/llm/llmv1beta1connect/service.connect.go @@ -0,0 +1,170 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: llm/service.proto + +package llmv1beta1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + llm "github.com/missingstudio/studio/protos/pkg/llm" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // LLMServiceName is the fully-qualified name of the LLMService service. + LLMServiceName = "llm.v1beta1.LLMService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // LLMServiceChatProcedure is the fully-qualified name of the LLMService's Chat RPC. + LLMServiceChatProcedure = "/llm.v1beta1.LLMService/Chat" + // LLMServiceCompletionProcedure is the fully-qualified name of the LLMService's Completion RPC. + LLMServiceCompletionProcedure = "/llm.v1beta1.LLMService/Completion" + // LLMServiceLoadModelProcedure is the fully-qualified name of the LLMService's LoadModel RPC. + LLMServiceLoadModelProcedure = "/llm.v1beta1.LLMService/LoadModel" +) + +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + lLMServiceServiceDescriptor = llm.File_llm_service_proto.Services().ByName("LLMService") + lLMServiceChatMethodDescriptor = lLMServiceServiceDescriptor.Methods().ByName("Chat") + lLMServiceCompletionMethodDescriptor = lLMServiceServiceDescriptor.Methods().ByName("Completion") + lLMServiceLoadModelMethodDescriptor = lLMServiceServiceDescriptor.Methods().ByName("LoadModel") +) + +// LLMServiceClient is a client for the llm.v1beta1.LLMService service. +type LLMServiceClient interface { + Chat(context.Context, *connect.Request[llm.ChatRequest]) (*connect.Response[llm.ChatPrediction], error) + Completion(context.Context, *connect.Request[llm.CompletionRequest]) (*connect.Response[llm.CompletionPrediction], error) + LoadModel(context.Context, *connect.Request[llm.LoadModelRequest]) (*connect.Response[llm.LoadModelResponse], error) +} + +// NewLLMServiceClient constructs a client for the llm.v1beta1.LLMService service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewLLMServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) LLMServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + return &lLMServiceClient{ + chat: connect.NewClient[llm.ChatRequest, llm.ChatPrediction]( + httpClient, + baseURL+LLMServiceChatProcedure, + connect.WithSchema(lLMServiceChatMethodDescriptor), + connect.WithClientOptions(opts...), + ), + completion: connect.NewClient[llm.CompletionRequest, llm.CompletionPrediction]( + httpClient, + baseURL+LLMServiceCompletionProcedure, + connect.WithSchema(lLMServiceCompletionMethodDescriptor), + connect.WithClientOptions(opts...), + ), + loadModel: connect.NewClient[llm.LoadModelRequest, llm.LoadModelResponse]( + httpClient, + baseURL+LLMServiceLoadModelProcedure, + connect.WithSchema(lLMServiceLoadModelMethodDescriptor), + connect.WithClientOptions(opts...), + ), + } +} + +// lLMServiceClient implements LLMServiceClient. +type lLMServiceClient struct { + chat *connect.Client[llm.ChatRequest, llm.ChatPrediction] + completion *connect.Client[llm.CompletionRequest, llm.CompletionPrediction] + loadModel *connect.Client[llm.LoadModelRequest, llm.LoadModelResponse] +} + +// Chat calls llm.v1beta1.LLMService.Chat. +func (c *lLMServiceClient) Chat(ctx context.Context, req *connect.Request[llm.ChatRequest]) (*connect.Response[llm.ChatPrediction], error) { + return c.chat.CallUnary(ctx, req) +} + +// Completion calls llm.v1beta1.LLMService.Completion. +func (c *lLMServiceClient) Completion(ctx context.Context, req *connect.Request[llm.CompletionRequest]) (*connect.Response[llm.CompletionPrediction], error) { + return c.completion.CallUnary(ctx, req) +} + +// LoadModel calls llm.v1beta1.LLMService.LoadModel. +func (c *lLMServiceClient) LoadModel(ctx context.Context, req *connect.Request[llm.LoadModelRequest]) (*connect.Response[llm.LoadModelResponse], error) { + return c.loadModel.CallUnary(ctx, req) +} + +// LLMServiceHandler is an implementation of the llm.v1beta1.LLMService service. +type LLMServiceHandler interface { + Chat(context.Context, *connect.Request[llm.ChatRequest]) (*connect.Response[llm.ChatPrediction], error) + Completion(context.Context, *connect.Request[llm.CompletionRequest]) (*connect.Response[llm.CompletionPrediction], error) + LoadModel(context.Context, *connect.Request[llm.LoadModelRequest]) (*connect.Response[llm.LoadModelResponse], error) +} + +// NewLLMServiceHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewLLMServiceHandler(svc LLMServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + lLMServiceChatHandler := connect.NewUnaryHandler( + LLMServiceChatProcedure, + svc.Chat, + connect.WithSchema(lLMServiceChatMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + lLMServiceCompletionHandler := connect.NewUnaryHandler( + LLMServiceCompletionProcedure, + svc.Completion, + connect.WithSchema(lLMServiceCompletionMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + lLMServiceLoadModelHandler := connect.NewUnaryHandler( + LLMServiceLoadModelProcedure, + svc.LoadModel, + connect.WithSchema(lLMServiceLoadModelMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + return "/llm.v1beta1.LLMService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case LLMServiceChatProcedure: + lLMServiceChatHandler.ServeHTTP(w, r) + case LLMServiceCompletionProcedure: + lLMServiceCompletionHandler.ServeHTTP(w, r) + case LLMServiceLoadModelProcedure: + lLMServiceLoadModelHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedLLMServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedLLMServiceHandler struct{} + +func (UnimplementedLLMServiceHandler) Chat(context.Context, *connect.Request[llm.ChatRequest]) (*connect.Response[llm.ChatPrediction], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("llm.v1beta1.LLMService.Chat is not implemented")) +} + +func (UnimplementedLLMServiceHandler) Completion(context.Context, *connect.Request[llm.CompletionRequest]) (*connect.Response[llm.CompletionPrediction], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("llm.v1beta1.LLMService.Completion is not implemented")) +} + +func (UnimplementedLLMServiceHandler) LoadModel(context.Context, *connect.Request[llm.LoadModelRequest]) (*connect.Response[llm.LoadModelResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("llm.v1beta1.LLMService.LoadModel is not implemented")) +} diff --git a/protos/pkg/llm/service.pb.go b/protos/pkg/llm/service.pb.go new file mode 100644 index 0000000..66eadcd --- /dev/null +++ b/protos/pkg/llm/service.pb.go @@ -0,0 +1,1070 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc (unknown) +// source: llm/service.proto + +package llmv1beta1 + +import ( + 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 ModelTag int32 + +const ( + ModelTag_MODEL_TYPE_UNKNOWN ModelTag = 0 + ModelTag_GENERAL ModelTag = 1 + ModelTag_CHAT ModelTag = 2 + ModelTag_TEXT ModelTag = 3 + ModelTag_CODE ModelTag = 4 +) + +// Enum value maps for ModelTag. +var ( + ModelTag_name = map[int32]string{ + 0: "MODEL_TYPE_UNKNOWN", + 1: "GENERAL", + 2: "CHAT", + 3: "TEXT", + 4: "CODE", + } + ModelTag_value = map[string]int32{ + "MODEL_TYPE_UNKNOWN": 0, + "GENERAL": 1, + "CHAT": 2, + "TEXT": 3, + "CODE": 4, + } +) + +func (x ModelTag) Enum() *ModelTag { + p := new(ModelTag) + *p = x + return p +} + +func (x ModelTag) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ModelTag) Descriptor() protoreflect.EnumDescriptor { + return file_llm_service_proto_enumTypes[0].Descriptor() +} + +func (ModelTag) Type() protoreflect.EnumType { + return &file_llm_service_proto_enumTypes[0] +} + +func (x ModelTag) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ModelTag.Descriptor instead. +func (ModelTag) EnumDescriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{0} +} + +type Status int32 + +const ( + Status_STATUS_UNKNOWN Status = 0 + Status_INITLIZING Status = 1 + Status_READY Status = 2 + Status_ERROR Status = 3 +) + +// Enum value maps for Status. +var ( + Status_name = map[int32]string{ + 0: "STATUS_UNKNOWN", + 1: "INITLIZING", + 2: "READY", + 3: "ERROR", + } + Status_value = map[string]int32{ + "STATUS_UNKNOWN": 0, + "INITLIZING": 1, + "READY": 2, + "ERROR": 3, + } +) + +func (x Status) Enum() *Status { + p := new(Status) + *p = x + return p +} + +func (x Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Status) Descriptor() protoreflect.EnumDescriptor { + return file_llm_service_proto_enumTypes[1].Descriptor() +} + +func (Status) Type() protoreflect.EnumType { + return &file_llm_service_proto_enumTypes[1] +} + +func (x Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Status.Descriptor instead. +func (Status) EnumDescriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{1} +} + +type Role int32 + +const ( + Role_ROLE_UNKNOWN Role = 0 + Role_SYSTEM Role = 1 + Role_USER Role = 2 + Role_ASSISTANT Role = 3 +) + +// Enum value maps for Role. +var ( + Role_name = map[int32]string{ + 0: "ROLE_UNKNOWN", + 1: "SYSTEM", + 2: "USER", + 3: "ASSISTANT", + } + Role_value = map[string]int32{ + "ROLE_UNKNOWN": 0, + "SYSTEM": 1, + "USER": 2, + "ASSISTANT": 3, + } +) + +func (x Role) Enum() *Role { + p := new(Role) + *p = x + return p +} + +func (x Role) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Role) Descriptor() protoreflect.EnumDescriptor { + return file_llm_service_proto_enumTypes[2].Descriptor() +} + +func (Role) Type() protoreflect.EnumType { + return &file_llm_service_proto_enumTypes[2] +} + +func (x Role) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Role.Descriptor instead. +func (Role) EnumDescriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{2} +} + +type AvaliableModel struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModelTagas []ModelTag `protobuf:"varint,1,rep,packed,name=model_tagas,json=modelTagas,proto3,enum=llm.v1beta1.ModelTag" json:"model_tagas,omitempty"` + ModelId uint32 `protobuf:"varint,2,opt,name=model_id,json=modelId,proto3" json:"model_id,omitempty"` + ModelName string `protobuf:"bytes,3,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` + Size string `protobuf:"bytes,4,opt,name=size,proto3" json:"size,omitempty"` + ModelDescription string `protobuf:"bytes,5,opt,name=model_description,json=modelDescription,proto3" json:"model_description,omitempty"` +} + +func (x *AvaliableModel) Reset() { + *x = AvaliableModel{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AvaliableModel) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AvaliableModel) ProtoMessage() {} + +func (x *AvaliableModel) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_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 AvaliableModel.ProtoReflect.Descriptor instead. +func (*AvaliableModel) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{0} +} + +func (x *AvaliableModel) GetModelTagas() []ModelTag { + if x != nil { + return x.ModelTagas + } + return nil +} + +func (x *AvaliableModel) GetModelId() uint32 { + if x != nil { + return x.ModelId + } + return 0 +} + +func (x *AvaliableModel) GetModelName() string { + if x != nil { + return x.ModelName + } + return "" +} + +func (x *AvaliableModel) GetSize() string { + if x != nil { + return x.Size + } + return "" +} + +func (x *AvaliableModel) GetModelDescription() string { + if x != nil { + return x.ModelDescription + } + return "" +} + +type LoadModelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ModelId uint32 `protobuf:"varint,1,opt,name=model_id,json=modelId,proto3" json:"model_id,omitempty"` + JsonModelParam string `protobuf:"bytes,999,opt,name=json_model_param,json=jsonModelParam,proto3" json:"json_model_param,omitempty"` +} + +func (x *LoadModelRequest) Reset() { + *x = LoadModelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoadModelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadModelRequest) ProtoMessage() {} + +func (x *LoadModelRequest) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_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 LoadModelRequest.ProtoReflect.Descriptor instead. +func (*LoadModelRequest) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{1} +} + +func (x *LoadModelRequest) GetModelId() uint32 { + if x != nil { + return x.ModelId + } + return 0 +} + +func (x *LoadModelRequest) GetJsonModelParam() string { + if x != nil { + return x.JsonModelParam + } + return "" +} + +type LoadModelResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrentStatus Status `protobuf:"varint,1,opt,name=current_status,json=currentStatus,proto3,enum=llm.v1beta1.Status" json:"current_status,omitempty"` + CurrentModel *AvaliableModel `protobuf:"bytes,2,opt,name=current_model,json=currentModel,proto3" json:"current_model,omitempty"` +} + +func (x *LoadModelResponse) Reset() { + *x = LoadModelResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoadModelResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadModelResponse) ProtoMessage() {} + +func (x *LoadModelResponse) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_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 LoadModelResponse.ProtoReflect.Descriptor instead. +func (*LoadModelResponse) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{2} +} + +func (x *LoadModelResponse) GetCurrentStatus() Status { + if x != nil { + return x.CurrentStatus + } + return Status_STATUS_UNKNOWN +} + +func (x *LoadModelResponse) GetCurrentModel() *AvaliableModel { + if x != nil { + return x.CurrentModel + } + return nil +} + +type InferenceArgs struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Temperature float32 `protobuf:"fixed32,1,opt,name=temperature,proto3" json:"temperature,omitempty"` + TopP float32 `protobuf:"fixed32,2,opt,name=top_p,json=topP,proto3" json:"top_p,omitempty"` + MaxGenLen uint32 `protobuf:"varint,3,opt,name=max_gen_len,json=maxGenLen,proto3" json:"max_gen_len,omitempty"` + RepetitionPenalty uint32 `protobuf:"varint,4,opt,name=repetition_penalty,json=repetitionPenalty,proto3" json:"repetition_penalty,omitempty"` + // A json string for extra args, will merge into inference args + // Map's value is not dynamic type, so we use json string + JsonExtraArgs string `protobuf:"bytes,999,opt,name=json_extra_args,json=jsonExtraArgs,proto3" json:"json_extra_args,omitempty"` +} + +func (x *InferenceArgs) Reset() { + *x = InferenceArgs{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InferenceArgs) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InferenceArgs) ProtoMessage() {} + +func (x *InferenceArgs) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_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 InferenceArgs.ProtoReflect.Descriptor instead. +func (*InferenceArgs) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{3} +} + +func (x *InferenceArgs) GetTemperature() float32 { + if x != nil { + return x.Temperature + } + return 0 +} + +func (x *InferenceArgs) GetTopP() float32 { + if x != nil { + return x.TopP + } + return 0 +} + +func (x *InferenceArgs) GetMaxGenLen() uint32 { + if x != nil { + return x.MaxGenLen + } + return 0 +} + +func (x *InferenceArgs) GetRepetitionPenalty() uint32 { + if x != nil { + return x.RepetitionPenalty + } + return 0 +} + +func (x *InferenceArgs) GetJsonExtraArgs() string { + if x != nil { + return x.JsonExtraArgs + } + return "" +} + +type CompletionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + Prompt string `protobuf:"bytes,2,opt,name=prompt,proto3" json:"prompt,omitempty"` + InferenceArgs *InferenceArgs `protobuf:"bytes,3,opt,name=inference_args,json=inferenceArgs,proto3" json:"inference_args,omitempty"` +} + +func (x *CompletionRequest) Reset() { + *x = CompletionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CompletionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompletionRequest) ProtoMessage() {} + +func (x *CompletionRequest) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_proto_msgTypes[4] + 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 CompletionRequest.ProtoReflect.Descriptor instead. +func (*CompletionRequest) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{4} +} + +func (x *CompletionRequest) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *CompletionRequest) GetPrompt() string { + if x != nil { + return x.Prompt + } + return "" +} + +func (x *CompletionRequest) GetInferenceArgs() *InferenceArgs { + if x != nil { + return x.InferenceArgs + } + return nil +} + +type CompletionPrediction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ResponseId string `protobuf:"bytes,2,opt,name=response_id,json=responseId,proto3" json:"response_id,omitempty"` + Generation string `protobuf:"bytes,3,opt,name=generation,proto3" json:"generation,omitempty"` +} + +func (x *CompletionPrediction) Reset() { + *x = CompletionPrediction{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CompletionPrediction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompletionPrediction) ProtoMessage() {} + +func (x *CompletionPrediction) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_proto_msgTypes[5] + 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 CompletionPrediction.ProtoReflect.Descriptor instead. +func (*CompletionPrediction) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{5} +} + +func (x *CompletionPrediction) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *CompletionPrediction) GetResponseId() string { + if x != nil { + return x.ResponseId + } + return "" +} + +func (x *CompletionPrediction) GetGeneration() string { + if x != nil { + return x.Generation + } + return "" +} + +type ChatMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=llm.v1beta1.Role" json:"role,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *ChatMessage) Reset() { + *x = ChatMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChatMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatMessage) ProtoMessage() {} + +func (x *ChatMessage) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_proto_msgTypes[6] + 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 ChatMessage.ProtoReflect.Descriptor instead. +func (*ChatMessage) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{6} +} + +func (x *ChatMessage) GetRole() Role { + if x != nil { + return x.Role + } + return Role_ROLE_UNKNOWN +} + +func (x *ChatMessage) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type ChatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + Messages []*ChatMessage `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + InferenceArgs *InferenceArgs `protobuf:"bytes,3,opt,name=inference_args,json=inferenceArgs,proto3" json:"inference_args,omitempty"` +} + +func (x *ChatRequest) Reset() { + *x = ChatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatRequest) ProtoMessage() {} + +func (x *ChatRequest) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatRequest.ProtoReflect.Descriptor instead. +func (*ChatRequest) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{7} +} + +func (x *ChatRequest) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *ChatRequest) GetMessages() []*ChatMessage { + if x != nil { + return x.Messages + } + return nil +} + +func (x *ChatRequest) GetInferenceArgs() *InferenceArgs { + if x != nil { + return x.InferenceArgs + } + return nil +} + +type ChatPrediction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + ResponseId string `protobuf:"bytes,2,opt,name=response_id,json=responseId,proto3" json:"response_id,omitempty"` + Message *ChatMessage `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *ChatPrediction) Reset() { + *x = ChatPrediction{} + if protoimpl.UnsafeEnabled { + mi := &file_llm_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChatPrediction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatPrediction) ProtoMessage() {} + +func (x *ChatPrediction) ProtoReflect() protoreflect.Message { + mi := &file_llm_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatPrediction.ProtoReflect.Descriptor instead. +func (*ChatPrediction) Descriptor() ([]byte, []int) { + return file_llm_service_proto_rawDescGZIP(), []int{8} +} + +func (x *ChatPrediction) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *ChatPrediction) GetResponseId() string { + if x != nil { + return x.ResponseId + } + return "" +} + +func (x *ChatPrediction) GetMessage() *ChatMessage { + if x != nil { + return x.Message + } + return nil +} + +var File_llm_service_proto protoreflect.FileDescriptor + +var file_llm_service_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x6c, 0x6c, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x22, 0xc3, 0x01, 0x0a, 0x0e, 0x41, 0x76, 0x61, 0x6c, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x6f, + 0x64, 0x65, 0x6c, 0x12, 0x36, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x74, 0x61, 0x67, + 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x61, 0x67, 0x61, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x58, 0x0a, 0x10, 0x4c, 0x6f, 0x61, 0x64, 0x4d, 0x6f, + 0x64, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0xe7, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x22, 0x91, 0x01, 0x0a, 0x11, 0x4c, 0x6f, 0x61, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, + 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x40, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x76, 0x61, 0x6c, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x4d, + 0x6f, 0x64, 0x65, 0x6c, 0x22, 0xbe, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x74, 0x65, 0x6d, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x5f, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x74, 0x6f, 0x70, 0x50, 0x12, 0x1e, 0x0a, + 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x67, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x47, 0x65, 0x6e, 0x4c, 0x65, 0x6e, 0x12, 0x2d, 0x0a, + 0x12, 0x72, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x65, 0x6e, 0x61, + 0x6c, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x72, 0x65, 0x70, 0x65, 0x74, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x12, 0x27, 0x0a, 0x0f, + 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, + 0xe7, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6a, 0x73, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x72, + 0x61, 0x41, 0x72, 0x67, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, + 0x6f, 0x6d, 0x70, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x6f, 0x6d, + 0x70, 0x74, 0x12, 0x41, 0x0a, 0x0e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x6c, 0x6d, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0d, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x22, 0x76, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, + 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, + 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4e, 0x0a, + 0x0b, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x04, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6c, 0x6c, 0x6d, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, + 0x6f, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xa5, 0x01, + 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, + 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x61, + 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x12, 0x41, 0x0a, 0x0e, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, + 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x6c, 0x6d, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x49, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x41, 0x72, 0x67, 0x73, 0x52, 0x0d, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x41, 0x72, 0x67, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x74, 0x50, 0x72, + 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x4d, 0x0a, 0x08, + 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x61, 0x67, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x4f, 0x44, 0x45, + 0x4c, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x45, 0x4e, 0x45, 0x52, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x08, 0x0a, + 0x04, 0x43, 0x48, 0x41, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x58, 0x54, 0x10, + 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x04, 0x2a, 0x42, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x4e, 0x49, + 0x54, 0x4c, 0x49, 0x5a, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, + 0x44, 0x59, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x2a, + 0x3d, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x4f, 0x4c, 0x45, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, + 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x02, 0x12, + 0x0d, 0x0a, 0x09, 0x41, 0x53, 0x53, 0x49, 0x53, 0x54, 0x41, 0x4e, 0x54, 0x10, 0x03, 0x32, 0xee, + 0x01, 0x0a, 0x0a, 0x4c, 0x4c, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, + 0x04, 0x43, 0x68, 0x61, 0x74, 0x12, 0x18, 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x68, + 0x61, 0x74, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x51, + 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x6c, + 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, + 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x00, 0x12, 0x4c, 0x0a, 0x09, 0x4c, 0x6f, 0x61, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x1d, + 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x61, + 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, + 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x61, 0x64, + 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0xa7, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x6c, 0x6d, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x39, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x73, 0x74, 0x75, 0x64, 0x69, 0x6f, 0x2f, 0x73, 0x74, + 0x75, 0x64, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x6c, 0x6c, 0x6d, 0x3b, 0x6c, 0x6c, 0x6d, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, + 0x03, 0x4c, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4c, 0x6c, 0x6d, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xca, 0x02, 0x0b, 0x4c, 0x6c, 0x6d, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0xe2, 0x02, 0x17, 0x4c, 0x6c, 0x6d, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4c, 0x6c, 0x6d, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_llm_service_proto_rawDescOnce sync.Once + file_llm_service_proto_rawDescData = file_llm_service_proto_rawDesc +) + +func file_llm_service_proto_rawDescGZIP() []byte { + file_llm_service_proto_rawDescOnce.Do(func() { + file_llm_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_llm_service_proto_rawDescData) + }) + return file_llm_service_proto_rawDescData +} + +var file_llm_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_llm_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_llm_service_proto_goTypes = []interface{}{ + (ModelTag)(0), // 0: llm.v1beta1.ModelTag + (Status)(0), // 1: llm.v1beta1.Status + (Role)(0), // 2: llm.v1beta1.Role + (*AvaliableModel)(nil), // 3: llm.v1beta1.AvaliableModel + (*LoadModelRequest)(nil), // 4: llm.v1beta1.LoadModelRequest + (*LoadModelResponse)(nil), // 5: llm.v1beta1.LoadModelResponse + (*InferenceArgs)(nil), // 6: llm.v1beta1.InferenceArgs + (*CompletionRequest)(nil), // 7: llm.v1beta1.CompletionRequest + (*CompletionPrediction)(nil), // 8: llm.v1beta1.CompletionPrediction + (*ChatMessage)(nil), // 9: llm.v1beta1.ChatMessage + (*ChatRequest)(nil), // 10: llm.v1beta1.ChatRequest + (*ChatPrediction)(nil), // 11: llm.v1beta1.ChatPrediction +} +var file_llm_service_proto_depIdxs = []int32{ + 0, // 0: llm.v1beta1.AvaliableModel.model_tagas:type_name -> llm.v1beta1.ModelTag + 1, // 1: llm.v1beta1.LoadModelResponse.current_status:type_name -> llm.v1beta1.Status + 3, // 2: llm.v1beta1.LoadModelResponse.current_model:type_name -> llm.v1beta1.AvaliableModel + 6, // 3: llm.v1beta1.CompletionRequest.inference_args:type_name -> llm.v1beta1.InferenceArgs + 2, // 4: llm.v1beta1.ChatMessage.role:type_name -> llm.v1beta1.Role + 9, // 5: llm.v1beta1.ChatRequest.messages:type_name -> llm.v1beta1.ChatMessage + 6, // 6: llm.v1beta1.ChatRequest.inference_args:type_name -> llm.v1beta1.InferenceArgs + 9, // 7: llm.v1beta1.ChatPrediction.message:type_name -> llm.v1beta1.ChatMessage + 10, // 8: llm.v1beta1.LLMService.Chat:input_type -> llm.v1beta1.ChatRequest + 7, // 9: llm.v1beta1.LLMService.Completion:input_type -> llm.v1beta1.CompletionRequest + 4, // 10: llm.v1beta1.LLMService.LoadModel:input_type -> llm.v1beta1.LoadModelRequest + 11, // 11: llm.v1beta1.LLMService.Chat:output_type -> llm.v1beta1.ChatPrediction + 8, // 12: llm.v1beta1.LLMService.Completion:output_type -> llm.v1beta1.CompletionPrediction + 5, // 13: llm.v1beta1.LLMService.LoadModel:output_type -> llm.v1beta1.LoadModelResponse + 11, // [11:14] is the sub-list for method output_type + 8, // [8:11] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_llm_service_proto_init() } +func file_llm_service_proto_init() { + if File_llm_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_llm_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AvaliableModel); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoadModelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LoadModelResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InferenceArgs); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CompletionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CompletionPrediction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChatMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_llm_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChatPrediction); 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_llm_service_proto_rawDesc, + NumEnums: 3, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_llm_service_proto_goTypes, + DependencyIndexes: file_llm_service_proto_depIdxs, + EnumInfos: file_llm_service_proto_enumTypes, + MessageInfos: file_llm_service_proto_msgTypes, + }.Build() + File_llm_service_proto = out.File + file_llm_service_proto_rawDesc = nil + file_llm_service_proto_goTypes = nil + file_llm_service_proto_depIdxs = nil +} diff --git a/protos/proto/buf.lock b/protos/proto/buf.lock new file mode 100644 index 0000000..0e5e890 --- /dev/null +++ b/protos/proto/buf.lock @@ -0,0 +1,18 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: bufbuild + repository: protovalidate + commit: e097f827e65240ac9fd4b1158849a8fc + digest: shake256:f19252436fd9ded945631e2ffaaed28247a92c9015ccf55ae99db9fb3d9600c4fdb00fd2d3bd7701026ec2fd4715c5129e6ae517c25a59ba690020cfe80bf8ad + - remote: buf.build + owner: googleapis + repository: googleapis + commit: a86849a25cc04f4dbe9b15ddddfbc488 + digest: shake256:e19143328f8cbfe13fc226aeee5e63773ca494693a72740a7560664270039a380d94a1344234b88c7691311460df9a9b1c2982190d0a2612eae80368718e1943 + - remote: buf.build + owner: grpc-ecosystem + repository: grpc-gateway + commit: 3f42134f4c564983838425bc43c7a65f + digest: shake256:3d11d4c0fe5e05fda0131afefbce233940e27f0c31c5d4e385686aea58ccd30f72053f61af432fa83f1fc11cda57f5f18ca3da26a29064f73c5a0d076bba8d92 diff --git a/protos/proto/buf.yaml b/protos/proto/buf.yaml new file mode 100644 index 0000000..eb99653 --- /dev/null +++ b/protos/proto/buf.yaml @@ -0,0 +1,11 @@ +version: v1 +deps: + - buf.build/googleapis/googleapis + - buf.build/bufbuild/protovalidate + - buf.build/grpc-ecosystem/grpc-gateway +breaking: + use: + - FILE +lint: + use: + - DEFAULT \ No newline at end of file diff --git a/protos/proto/greeting/v1/service.proto b/protos/proto/greeting/v1/service.proto new file mode 100644 index 0000000..5c06f1c --- /dev/null +++ b/protos/proto/greeting/v1/service.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package greeting.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "buf/validate/validate.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/error_details.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; +option go_package = "github.com/missingstudio/protos/pkg/greeting/v1;greetingv1"; + +message GreetRequest { + string name = 1 [(buf.validate.field).string.min_len = 2];; +} + +message GreetResponse { + string greeting = 1; +} + +service GreetService { + rpc Greet(GreetRequest) returns (GreetResponse) { + option (google.api.http) = { get: "/v1/greet" }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + responses: [ + { + key: "200"; + value: { + description: "Returns greeting message"; + schema: { + json_schema: {ref: ".greeting.v1.Greet"}; + }; + }; + }, + { + key: "400"; + value: { + description: "Provides details telling the user about why the request was bad"; + schema: { + json_schema: {ref: ".google.rpc.BadRequest"}; + }; + }; + }, + { + key: "401"; + value: { + description: "Provides details telling the user he is unauthenticated"; + schema: { + json_schema: {ref: ".google.rpc.ErrorInfo"}; + }; + }; + }, + { + key: "403"; + value: { + description: "Provides details telling the user he is unauthorized to perform the requested operation"; + schema: { + json_schema: {ref: ".google.rpc.ErrorInfo"}; + }; + }; + }, + { + key: "404"; + value: { + description: "Tells that the resource could not be found"; + schema: { + json_schema: {ref: ".google.rpc.ErrorInfo"}; + }; + }; + } + ]; + }; + } + +} \ No newline at end of file diff --git a/protos/proto/llm/service.proto b/protos/proto/llm/service.proto new file mode 100644 index 0000000..e15826e --- /dev/null +++ b/protos/proto/llm/service.proto @@ -0,0 +1,92 @@ +syntax = "proto3"; +package llm.v1beta1; + + +service LLMService { + rpc Chat(ChatRequest) returns (ChatPrediction) {} + rpc Completion(CompletionRequest) returns (CompletionPrediction) {} + rpc LoadModel(LoadModelRequest) returns (LoadModelResponse) {} +} + +enum ModelTag{ + MODEL_TYPE_UNKNOWN = 0; + GENERAL = 1; + CHAT = 2; + TEXT = 3; + CODE = 4; +} + +enum Status{ + STATUS_UNKNOWN = 0; + INITLIZING = 1; + READY = 2; + ERROR = 3; +} + + +message AvaliableModel { + repeated ModelTag model_tagas = 1; + uint32 model_id = 2; + string model_name = 3; + string size = 4; + string model_description = 5; +} + +message LoadModelRequest { + uint32 model_id = 1; + + string json_model_param = 999; +} + +message LoadModelResponse { + Status current_status = 1; + AvaliableModel current_model = 2; +} + +enum Role { + ROLE_UNKNOWN = 0; + SYSTEM = 1; + USER = 2; + ASSISTANT = 3; +} + + +message InferenceArgs { + float temperature = 1; + float top_p = 2; + uint32 max_gen_len = 3; + uint32 repetition_penalty = 4; + + // A json string for extra args, will merge into inference args + // Map's value is not dynamic type, so we use json string + string json_extra_args = 999; +} + +message CompletionRequest{ + string request_id = 1; + string prompt = 2; + InferenceArgs inference_args = 3; +} + +message CompletionPrediction{ + string request_id = 1; + string response_id = 2; + string generation = 3; +} + +message ChatMessage{ + Role role = 1; + string content = 2; +} + +message ChatRequest{ + string request_id = 1; + repeated ChatMessage messages = 2; + InferenceArgs inference_args = 3; +} + +message ChatPrediction{ + string request_id = 1; + string response_id = 2; + ChatMessage message = 3; +} \ No newline at end of file diff --git a/protos/src/greeting/v1/service_connect.ts b/protos/src/greeting/v1/service_connect.ts new file mode 100644 index 0000000..fe9f54d --- /dev/null +++ b/protos/src/greeting/v1/service_connect.ts @@ -0,0 +1,26 @@ +// @generated by protoc-gen-connect-es v1.2.0 with parameter "target=ts,import_extension=" +// @generated from file greeting/v1/service.proto (package greeting.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { GreetRequest, GreetResponse } from "./service_pb"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service greeting.v1.GreetService + */ +export const GreetService = { + typeName: "greeting.v1.GreetService", + methods: { + /** + * @generated from rpc greeting.v1.GreetService.Greet + */ + greet: { + name: "Greet", + I: GreetRequest, + O: GreetResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/protos/src/greeting/v1/service_pb.ts b/protos/src/greeting/v1/service_pb.ts new file mode 100644 index 0000000..32b70bd --- /dev/null +++ b/protos/src/greeting/v1/service_pb.ts @@ -0,0 +1,82 @@ +// @generated by protoc-gen-es v1.6.0 with parameter "target=ts,import_extension=" +// @generated from file greeting/v1/service.proto (package greeting.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message greeting.v1.GreetRequest + */ +export class GreetRequest extends Message { + /** + * @generated from field: string name = 1; + */ + name = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "greeting.v1.GreetRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GreetRequest { + return new GreetRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GreetRequest { + return new GreetRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GreetRequest { + return new GreetRequest().fromJsonString(jsonString, options); + } + + static equals(a: GreetRequest | PlainMessage | undefined, b: GreetRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(GreetRequest, a, b); + } +} + +/** + * @generated from message greeting.v1.GreetResponse + */ +export class GreetResponse extends Message { + /** + * @generated from field: string greeting = 1; + */ + greeting = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "greeting.v1.GreetResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "greeting", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GreetResponse { + return new GreetResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GreetResponse { + return new GreetResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GreetResponse { + return new GreetResponse().fromJsonString(jsonString, options); + } + + static equals(a: GreetResponse | PlainMessage | undefined, b: GreetResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(GreetResponse, a, b); + } +} + diff --git a/protos/src/llm/service_connect.ts b/protos/src/llm/service_connect.ts new file mode 100644 index 0000000..e5f5db6 --- /dev/null +++ b/protos/src/llm/service_connect.ts @@ -0,0 +1,44 @@ +// @generated by protoc-gen-connect-es v1.2.0 with parameter "target=ts,import_extension=" +// @generated from file llm/service.proto (package llm.v1beta1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { ChatPrediction, ChatRequest, CompletionPrediction, CompletionRequest, LoadModelRequest, LoadModelResponse } from "./service_pb"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service llm.v1beta1.LLMService + */ +export const LLMService = { + typeName: "llm.v1beta1.LLMService", + methods: { + /** + * @generated from rpc llm.v1beta1.LLMService.Chat + */ + chat: { + name: "Chat", + I: ChatRequest, + O: ChatPrediction, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc llm.v1beta1.LLMService.Completion + */ + completion: { + name: "Completion", + I: CompletionRequest, + O: CompletionPrediction, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc llm.v1beta1.LLMService.LoadModel + */ + loadModel: { + name: "LoadModel", + I: LoadModelRequest, + O: LoadModelResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/protos/src/llm/service_pb.ts b/protos/src/llm/service_pb.ts new file mode 100644 index 0000000..f9b7674 --- /dev/null +++ b/protos/src/llm/service_pb.ts @@ -0,0 +1,560 @@ +// @generated by protoc-gen-es v1.6.0 with parameter "target=ts,import_extension=" +// @generated from file llm/service.proto (package llm.v1beta1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum llm.v1beta1.ModelTag + */ +export enum ModelTag { + /** + * @generated from enum value: MODEL_TYPE_UNKNOWN = 0; + */ + MODEL_TYPE_UNKNOWN = 0, + + /** + * @generated from enum value: GENERAL = 1; + */ + GENERAL = 1, + + /** + * @generated from enum value: CHAT = 2; + */ + CHAT = 2, + + /** + * @generated from enum value: TEXT = 3; + */ + TEXT = 3, + + /** + * @generated from enum value: CODE = 4; + */ + CODE = 4, +} +// Retrieve enum metadata with: proto3.getEnumType(ModelTag) +proto3.util.setEnumType(ModelTag, "llm.v1beta1.ModelTag", [ + { no: 0, name: "MODEL_TYPE_UNKNOWN" }, + { no: 1, name: "GENERAL" }, + { no: 2, name: "CHAT" }, + { no: 3, name: "TEXT" }, + { no: 4, name: "CODE" }, +]); + +/** + * @generated from enum llm.v1beta1.Status + */ +export enum Status { + /** + * @generated from enum value: STATUS_UNKNOWN = 0; + */ + STATUS_UNKNOWN = 0, + + /** + * @generated from enum value: INITLIZING = 1; + */ + INITLIZING = 1, + + /** + * @generated from enum value: READY = 2; + */ + READY = 2, + + /** + * @generated from enum value: ERROR = 3; + */ + ERROR = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(Status) +proto3.util.setEnumType(Status, "llm.v1beta1.Status", [ + { no: 0, name: "STATUS_UNKNOWN" }, + { no: 1, name: "INITLIZING" }, + { no: 2, name: "READY" }, + { no: 3, name: "ERROR" }, +]); + +/** + * @generated from enum llm.v1beta1.Role + */ +export enum Role { + /** + * @generated from enum value: ROLE_UNKNOWN = 0; + */ + ROLE_UNKNOWN = 0, + + /** + * @generated from enum value: SYSTEM = 1; + */ + SYSTEM = 1, + + /** + * @generated from enum value: USER = 2; + */ + USER = 2, + + /** + * @generated from enum value: ASSISTANT = 3; + */ + ASSISTANT = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(Role) +proto3.util.setEnumType(Role, "llm.v1beta1.Role", [ + { no: 0, name: "ROLE_UNKNOWN" }, + { no: 1, name: "SYSTEM" }, + { no: 2, name: "USER" }, + { no: 3, name: "ASSISTANT" }, +]); + +/** + * @generated from message llm.v1beta1.AvaliableModel + */ +export class AvaliableModel extends Message { + /** + * @generated from field: repeated llm.v1beta1.ModelTag model_tagas = 1; + */ + modelTagas: ModelTag[] = []; + + /** + * @generated from field: uint32 model_id = 2; + */ + modelId = 0; + + /** + * @generated from field: string model_name = 3; + */ + modelName = ""; + + /** + * @generated from field: string size = 4; + */ + size = ""; + + /** + * @generated from field: string model_description = 5; + */ + modelDescription = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.AvaliableModel"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "model_tagas", kind: "enum", T: proto3.getEnumType(ModelTag), repeated: true }, + { no: 2, name: "model_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 3, name: "model_name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "size", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "model_description", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AvaliableModel { + return new AvaliableModel().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AvaliableModel { + return new AvaliableModel().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AvaliableModel { + return new AvaliableModel().fromJsonString(jsonString, options); + } + + static equals(a: AvaliableModel | PlainMessage | undefined, b: AvaliableModel | PlainMessage | undefined): boolean { + return proto3.util.equals(AvaliableModel, a, b); + } +} + +/** + * @generated from message llm.v1beta1.LoadModelRequest + */ +export class LoadModelRequest extends Message { + /** + * @generated from field: uint32 model_id = 1; + */ + modelId = 0; + + /** + * @generated from field: string json_model_param = 999; + */ + jsonModelParam = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.LoadModelRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "model_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 999, name: "json_model_param", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LoadModelRequest { + return new LoadModelRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LoadModelRequest { + return new LoadModelRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LoadModelRequest { + return new LoadModelRequest().fromJsonString(jsonString, options); + } + + static equals(a: LoadModelRequest | PlainMessage | undefined, b: LoadModelRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(LoadModelRequest, a, b); + } +} + +/** + * @generated from message llm.v1beta1.LoadModelResponse + */ +export class LoadModelResponse extends Message { + /** + * @generated from field: llm.v1beta1.Status current_status = 1; + */ + currentStatus = Status.STATUS_UNKNOWN; + + /** + * @generated from field: llm.v1beta1.AvaliableModel current_model = 2; + */ + currentModel?: AvaliableModel; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.LoadModelResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "current_status", kind: "enum", T: proto3.getEnumType(Status) }, + { no: 2, name: "current_model", kind: "message", T: AvaliableModel }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LoadModelResponse { + return new LoadModelResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LoadModelResponse { + return new LoadModelResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LoadModelResponse { + return new LoadModelResponse().fromJsonString(jsonString, options); + } + + static equals(a: LoadModelResponse | PlainMessage | undefined, b: LoadModelResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(LoadModelResponse, a, b); + } +} + +/** + * @generated from message llm.v1beta1.InferenceArgs + */ +export class InferenceArgs extends Message { + /** + * @generated from field: float temperature = 1; + */ + temperature = 0; + + /** + * @generated from field: float top_p = 2; + */ + topP = 0; + + /** + * @generated from field: uint32 max_gen_len = 3; + */ + maxGenLen = 0; + + /** + * @generated from field: uint32 repetition_penalty = 4; + */ + repetitionPenalty = 0; + + /** + * A json string for extra args, will merge into inference args + * Map's value is not dynamic type, so we use json string + * + * @generated from field: string json_extra_args = 999; + */ + jsonExtraArgs = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.InferenceArgs"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "temperature", kind: "scalar", T: 2 /* ScalarType.FLOAT */ }, + { no: 2, name: "top_p", kind: "scalar", T: 2 /* ScalarType.FLOAT */ }, + { no: 3, name: "max_gen_len", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 4, name: "repetition_penalty", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 999, name: "json_extra_args", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): InferenceArgs { + return new InferenceArgs().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): InferenceArgs { + return new InferenceArgs().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): InferenceArgs { + return new InferenceArgs().fromJsonString(jsonString, options); + } + + static equals(a: InferenceArgs | PlainMessage | undefined, b: InferenceArgs | PlainMessage | undefined): boolean { + return proto3.util.equals(InferenceArgs, a, b); + } +} + +/** + * @generated from message llm.v1beta1.CompletionRequest + */ +export class CompletionRequest extends Message { + /** + * @generated from field: string request_id = 1; + */ + requestId = ""; + + /** + * @generated from field: string prompt = 2; + */ + prompt = ""; + + /** + * @generated from field: llm.v1beta1.InferenceArgs inference_args = 3; + */ + inferenceArgs?: InferenceArgs; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.CompletionRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "prompt", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "inference_args", kind: "message", T: InferenceArgs }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CompletionRequest { + return new CompletionRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CompletionRequest { + return new CompletionRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CompletionRequest { + return new CompletionRequest().fromJsonString(jsonString, options); + } + + static equals(a: CompletionRequest | PlainMessage | undefined, b: CompletionRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(CompletionRequest, a, b); + } +} + +/** + * @generated from message llm.v1beta1.CompletionPrediction + */ +export class CompletionPrediction extends Message { + /** + * @generated from field: string request_id = 1; + */ + requestId = ""; + + /** + * @generated from field: string response_id = 2; + */ + responseId = ""; + + /** + * @generated from field: string generation = 3; + */ + generation = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.CompletionPrediction"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "response_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "generation", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CompletionPrediction { + return new CompletionPrediction().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CompletionPrediction { + return new CompletionPrediction().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CompletionPrediction { + return new CompletionPrediction().fromJsonString(jsonString, options); + } + + static equals(a: CompletionPrediction | PlainMessage | undefined, b: CompletionPrediction | PlainMessage | undefined): boolean { + return proto3.util.equals(CompletionPrediction, a, b); + } +} + +/** + * @generated from message llm.v1beta1.ChatMessage + */ +export class ChatMessage extends Message { + /** + * @generated from field: llm.v1beta1.Role role = 1; + */ + role = Role.ROLE_UNKNOWN; + + /** + * @generated from field: string content = 2; + */ + content = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.ChatMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "role", kind: "enum", T: proto3.getEnumType(Role) }, + { no: 2, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ChatMessage { + return new ChatMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ChatMessage { + return new ChatMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ChatMessage { + return new ChatMessage().fromJsonString(jsonString, options); + } + + static equals(a: ChatMessage | PlainMessage | undefined, b: ChatMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(ChatMessage, a, b); + } +} + +/** + * @generated from message llm.v1beta1.ChatRequest + */ +export class ChatRequest extends Message { + /** + * @generated from field: string request_id = 1; + */ + requestId = ""; + + /** + * @generated from field: repeated llm.v1beta1.ChatMessage messages = 2; + */ + messages: ChatMessage[] = []; + + /** + * @generated from field: llm.v1beta1.InferenceArgs inference_args = 3; + */ + inferenceArgs?: InferenceArgs; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.ChatRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "messages", kind: "message", T: ChatMessage, repeated: true }, + { no: 3, name: "inference_args", kind: "message", T: InferenceArgs }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ChatRequest { + return new ChatRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ChatRequest { + return new ChatRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ChatRequest { + return new ChatRequest().fromJsonString(jsonString, options); + } + + static equals(a: ChatRequest | PlainMessage | undefined, b: ChatRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(ChatRequest, a, b); + } +} + +/** + * @generated from message llm.v1beta1.ChatPrediction + */ +export class ChatPrediction extends Message { + /** + * @generated from field: string request_id = 1; + */ + requestId = ""; + + /** + * @generated from field: string response_id = 2; + */ + responseId = ""; + + /** + * @generated from field: llm.v1beta1.ChatMessage message = 3; + */ + message?: ChatMessage; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "llm.v1beta1.ChatPrediction"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "request_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "response_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "message", kind: "message", T: ChatMessage }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ChatPrediction { + return new ChatPrediction().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ChatPrediction { + return new ChatPrediction().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ChatPrediction { + return new ChatPrediction().fromJsonString(jsonString, options); + } + + static equals(a: ChatPrediction | PlainMessage | undefined, b: ChatPrediction | PlainMessage | undefined): boolean { + return proto3.util.equals(ChatPrediction, a, b); + } +} +