Skip to content

Commit

Permalink
📦 Release: v0.0.1-rc.2 (#102)
Browse files Browse the repository at this point in the history
# Changelog

## Improvements

- ⚙️ [config] Added validation for config file content #40 (@roma-glushko)
- ⚙️ [config] Allowed to pass HTTP server configs from config file #41 (@roma-glushko)
- 👷 [build] Allowed building Homebrew taps for release candidates #99 (@roma-glushko)
  • Loading branch information
roma-glushko authored Jan 22, 2024
1 parent 16db2ad commit 2c8ca01
Show file tree
Hide file tree
Showing 27 changed files with 434 additions and 66 deletions.
9 changes: 1 addition & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,7 @@ brews:
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
#
# Templates: allowed
skip_upload: auto

# Custom block for brew.
# Can be used to specify alternate downloads for devel or head releases.
custom_block: |
head "https://github.com/some/package.git"
...
skip_upload: false # auto

# Packages your package depends on.
dependencies: []
Expand Down Expand Up @@ -225,7 +219,6 @@ brews:
#
# Templates: allowed
url: 'git@github.com:EinStack/homebrew-tap.git'

private_key: '{{ .Env.BREW_TAP_PRIVATE_KEY }}'

announce:
Expand Down
22 changes: 15 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@ The changelog consists of three categories:
- **Improvements** - bugfixes, performance and other types of improvements to existing functionality
- **Miscellaneous** - all other updates like build, release, CLI, etc.

## 0.0.1-rc.2 (Jan 22nd, 2024)

### Improvements

- ⚙️ [config] Added validation for config file content #40 (@roma-glushko)
- ⚙️ [config] Allowed to pass HTTP server configs from config file #41 (@roma-glushko)
- 👷 [build] Allowed building Homebrew taps for release candidates #99 (@roma-glushko)

## 0.0.1-rc.1 (Jan 21st, 2024)

### Features
-[providers] Support for OpenAI Chat API #3 (@mkrueger12 )
-[API] #54 Unified Chat API (@mkrueger12 )
-[providers] Support for Cohere Chat API #5 (@mkrueger12 )
-[providers] Support for Azure OpenAI Chat API #4 (@mkrueger12 )
-[providers] Support for OctoML Chat API #58 (@mkrueger12 )
-[providers] Support for OpenAI Chat API #3 (@mkrueger12)
-[API] Unified Chat API #54 (@mkrueger12)
-[providers] Support for Cohere Chat API #5 (@mkrueger12)
-[providers] Support for Azure OpenAI Chat API #4 (@mkrueger12)
-[providers] Support for OctoML Chat API #58 (@mkrueger12)
-[routing] The Routing Mechanism, Adaptive Health Tracking, and Fallbacks #42 #43 #51 (@roma-glushko)
-[routing] Support for round robin routing strategy #44 (@roma-glushko)
-[routing] Support for the least latency routing strategy #46 (@roma-glushko)
-[routing] Support for weighted round robin routing strategy #45 (@roma-glushko)
-[providers] Support for Anthropic Chat API #60 (@mkrueger12 )
-[docs] OpenAPI specifications #22 (@roma-glushko )
-[providers] Support for Anthropic Chat API #60 (@mkrueger12)
-[docs] OpenAPI specifications #22 (@roma-glushko)

### Miscellaneous

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Once deployed, Glide comes with OpenAPI documentation that is accessible via htt

## Community

- Join [Discord](https://discord.gg/z4DmAbJP) for real-time discussion
- Join [Discord](https://discord.gg/pt53Ej7rrc) for real-time discussion

Open [an issue](https://github.com/modelgateway/glide/issues) or start [a discussion](https://github.com/modelgateway/glide/discussions)
if there is a feature or an enhancement you'd like to see in Glide.
Expand Down
6 changes: 1 addition & 5 deletions config.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ telemetry:
level: debug # debug, info, warn, error, fatal
encoding: console

#api:
# http:
# ...

routers:
language:
- id: myrouter
Expand All @@ -18,4 +14,4 @@ routers:
azureopenai:
api_key: ""
model: ""
base_url: ""
base_url: ""
14 changes: 12 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ const docTemplate = `{
"providers.LangModelConfig": {
"type": "object",
"required": [
"enabled",
"id"
],
"properties": {
Expand Down Expand Up @@ -539,7 +540,12 @@ const docTemplate = `{
"$ref": "#/definitions/octoml.Config"
},
"openai": {
"$ref": "#/definitions/openai.Config"
"description": "Add other providers like",
"allOf": [
{
"$ref": "#/definitions/openai.Config"
}
]
},
"weight": {
"type": "integer"
Expand All @@ -566,8 +572,11 @@ const docTemplate = `{
"routers.LangRouterConfig": {
"type": "object",
"required": [
"enabled",
"models",
"routers"
"retry",
"routers",
"strategy"
],
"properties": {
"enabled": {
Expand All @@ -577,6 +586,7 @@ const docTemplate = `{
"models": {
"description": "the list of models that could handle requests",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/providers.LangModelConfig"
}
Expand Down
14 changes: 12 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@
"providers.LangModelConfig": {
"type": "object",
"required": [
"enabled",
"id"
],
"properties": {
Expand Down Expand Up @@ -536,7 +537,12 @@
"$ref": "#/definitions/octoml.Config"
},
"openai": {
"$ref": "#/definitions/openai.Config"
"description": "Add other providers like",
"allOf": [
{
"$ref": "#/definitions/openai.Config"
}
]
},
"weight": {
"type": "integer"
Expand All @@ -563,8 +569,11 @@
"routers.LangRouterConfig": {
"type": "object",
"required": [
"enabled",
"models",
"routers"
"retry",
"routers",
"strategy"
],
"properties": {
"enabled": {
Expand All @@ -574,6 +583,7 @@
"models": {
"description": "the list of models that could handle requests",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/providers.LangModelConfig"
}
Expand Down
9 changes: 8 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,13 @@ definitions:
octoml:
$ref: '#/definitions/octoml.Config'
openai:
$ref: '#/definitions/openai.Config'
allOf:
- $ref: '#/definitions/openai.Config'
description: Add other providers like
weight:
type: integer
required:
- enabled
- id
type: object
retry.ExpRetryConfig:
Expand All @@ -305,6 +308,7 @@ definitions:
description: the list of models that could handle requests
items:
$ref: '#/definitions/providers.LangModelConfig'
minItems: 1
type: array
retry:
allOf:
Expand All @@ -317,8 +321,11 @@ definitions:
description: strategy on picking the next model to serve the request
type: string
required:
- enabled
- models
- retry
- routers
- strategy
type: object
schemas.ChatMessage:
properties:
Expand Down
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.21.5

require (
github.com/cloudwego/hertz v0.7.3
github.com/go-playground/validator/v10 v10.17.0
github.com/hertz-contrib/logger/zap v1.1.0
github.com/hertz-contrib/swagger v0.1.0
github.com/spf13/cobra v1.8.0
Expand All @@ -28,14 +29,18 @@ require (
github.com/cloudwego/netpoll v0.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/spec v0.20.13 // indirect
github.com/go-openapi/swag v0.22.7 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/nyaruka/phonenumbers v1.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -45,6 +50,7 @@ require (
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
golang.org/x/arch v0.6.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q=
github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs=
github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU=
Expand All @@ -43,6 +45,14 @@ github.com/go-openapi/spec v0.20.13 h1:XJDIN+dLH6vqXgafnl5SUIMnzaChQ6QTo0/UPMbkI
github.com/go-openapi/spec v0.20.13/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw=
github.com/go-openapi/swag v0.22.7 h1:JWrc1uc/P9cSomxfnsFSVWoE1FW6bNbrVPmpQYpCcR8=
github.com/go-openapi/swag v0.22.7/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ4E5T9gDA0AIH74=
github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
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=
Expand Down Expand Up @@ -71,6 +81,8 @@ 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/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/nyaruka/phonenumbers v1.0.55/go.mod h1:sDaTZ/KPX5f8qyV9qN+hIm+4ZBARJrupC6LuhshJq1U=
Expand Down Expand Up @@ -99,6 +111,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
Expand Down Expand Up @@ -129,6 +142,8 @@ golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc=
golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ func main() {
cli := cmd.NewCLI()

if err := cli.Execute(); err != nil {
log.Fatalf("glide run finished with error: %v", err)
log.Fatalf("💥Glide has finished with error: %v", err)
}
}
2 changes: 1 addition & 1 deletion pkg/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "glide/pkg/api/http"

// Config defines configuration for all API types we support (e.g. HTTP, gRPC)
type Config struct {
HTTP *http.ServerConfig `yaml:"http"`
HTTP *http.ServerConfig `yaml:"http" validate:"required"`
}

func DefaultConfig() *Config {
Expand Down
54 changes: 46 additions & 8 deletions pkg/api/http/config.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,66 @@
package http

import (
"fmt"
"time"

"github.com/cloudwego/hertz/pkg/common/config"

"github.com/cloudwego/hertz/pkg/app/server"
"github.com/cloudwego/hertz/pkg/network/netpoll"
)

type ServerConfig struct {
HostPort string
Host string `yaml:"host"`
Port int `yaml:"port"`
ReadTimeout *time.Duration `yaml:"read_timeout"`
WriteTimeout *time.Duration `yaml:"write_timeout"`
IdleTimeout *time.Duration `yaml:"idle_timeout"`
MaxRequestBodySize *int `yaml:"max_request_body_size"`
}

func DefaultServerConfig() *ServerConfig {
maxReqBodySize := 4 * 1024 * 1024
readTimeout := 3 * time.Second
writeTimeout := 3 * time.Second
idleTimeout := 1 * time.Second

return &ServerConfig{
HostPort: "127.0.0.1:9099",
Host: "127.0.0.1",
Port: 9099,
IdleTimeout: &idleTimeout,
ReadTimeout: &readTimeout,
WriteTimeout: &writeTimeout,
MaxRequestBodySize: &maxReqBodySize,
}
}

func (cfg *ServerConfig) Address() string {
return fmt.Sprintf("%s:%v", cfg.Host, cfg.Port)
}

func (cfg *ServerConfig) ToServer() *server.Hertz {
// TODO: do real server build based on provided config
return server.Default(
server.WithIdleTimeout(1*time.Second),
server.WithHostPorts(cfg.HostPort),
server.WithMaxRequestBodySize(20<<20),
// More configs are listed on https://www.cloudwego.io/docs/hertz/tutorials/basic-feature/engine/
serverOptions := []config.Option{
server.WithHostPorts(cfg.Address()),
server.WithTransport(netpoll.NewTransporter),
)
}

if cfg.IdleTimeout != nil {
serverOptions = append(serverOptions, server.WithIdleTimeout(*cfg.IdleTimeout))
}

if cfg.ReadTimeout != nil {
serverOptions = append(serverOptions, server.WithReadTimeout(*cfg.ReadTimeout))
}

if cfg.WriteTimeout != nil {
serverOptions = append(serverOptions, server.WithWriteTimeout(*cfg.WriteTimeout))
}

if cfg.MaxRequestBodySize != nil {
serverOptions = append(serverOptions, server.WithMaxRequestBodySize(*cfg.MaxRequestBodySize))
}

return server.Default(serverOptions...)
}
2 changes: 1 addition & 1 deletion pkg/api/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (srv *Server) Run() error {

defaultGroup.GET("/health/", HealthHandler)

schemaDocURL := swagger.URL(fmt.Sprintf("http://%v/v1/swagger/doc.json", srv.config.HostPort))
schemaDocURL := swagger.URL(fmt.Sprintf("http://%v/v1/swagger/doc.json", srv.config.Address()))
defaultGroup.GET("/swagger/*any", swagger.WrapHandler(swaggerFiles.Handler, schemaDocURL))

return srv.server.Run()
Expand Down
Loading

0 comments on commit 2c8ca01

Please sign in to comment.