Skip to content

Commit

Permalink
feat: enable Rest api using grpc-gateway (#834)
Browse files Browse the repository at this point in the history
* grpc-gateway changes

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: grpc-gateway impl

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: enable REST/http api support

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: enable rest/http support

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: enable rest/http support

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: enable rest/http support

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* chore: resolved mod

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* feat: fix grpc-gateway codegen path

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: merge from master

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

* feat: flag to enable rest api

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>

---------

Signed-off-by: Sahil Badla <sahil_badla@intuit.com>
Signed-off-by: Sahil Badla <146279034+sbadla1@users.noreply.github.com>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Sahil Badla <sahil_badla@intuit.com>
Co-authored-by: Thomas Schuetz <38893055+thschue@users.noreply.github.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
  • Loading branch information
4 people committed Feb 17, 2024
1 parent 3f0356b commit f2138c7
Show file tree
Hide file tree
Showing 4 changed files with 849 additions and 10 deletions.
3 changes: 3 additions & 0 deletions cmd/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
port string
metricsPort string
backend string
enableHttp bool
)

var ServeCmd = &cobra.Command{
Expand Down Expand Up @@ -131,6 +132,7 @@ var ServeCmd = &cobra.Command{
Backend: aiProvider.Name,
Port: port,
MetricsPort: metricsPort,
EnableHttp: enableHttp,
Token: aiProvider.Password,
Logger: logger,
}
Expand Down Expand Up @@ -158,4 +160,5 @@ func init() {
ServeCmd.Flags().StringVarP(&port, "port", "p", "8080", "Port to run the server on")
ServeCmd.Flags().StringVarP(&metricsPort, "metrics-port", "", "8081", "Port to run the metrics-server on")
ServeCmd.Flags().StringVarP(&backend, "backend", "b", "openai", "Backend AI provider")
ServeCmd.Flags().BoolVarP(&enableHttp, "http", "h", false, "Enable REST/http using gppc-gateway")
}
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ require (
require github.com/adrg/xdg v0.4.0

require (
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc-ecosystem/gateway/v2 v2.19.1-20240213144542-6e830f3fdf19.1
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20240213144542-6e830f3fdf19.2
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.32.0-20240213144542-6e830f3fdf19.1
cloud.google.com/go/storage v1.37.0
Expand All @@ -32,6 +33,7 @@ require (
github.com/aws/aws-sdk-go v1.50.20
github.com/cohere-ai/cohere-go v0.2.0
github.com/google/generative-ai-go v0.7.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/hupe1980/go-huggingface v0.0.15
github.com/olekukonko/tablewriter v0.0.5
github.com/prometheus/prometheus v0.49.1
Expand All @@ -48,7 +50,7 @@ require (
atomicgo.dev/schedule v0.1.0 // indirect
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/ai v0.3.0 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/longrunning v0.5.4 // indirect
Expand Down Expand Up @@ -92,7 +94,7 @@ require (
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel/metric v1.23.0 // indirect
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 // indirect
gopkg.in/evanphx/json-patch.v5 v5.7.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down Expand Up @@ -216,7 +218,7 @@ require (
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
Expand Down
Loading

0 comments on commit f2138c7

Please sign in to comment.