Skip to content

Commit

Permalink
#67: Fixed a part of linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Aug 8, 2024
1 parent 003691c commit e043e4d
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions pkg/models/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package models

import (
"fmt"

"github.com/EinStack/glide/pkg/clients"
"github.com/EinStack/glide/pkg/provider"
"github.com/EinStack/glide/pkg/resiliency/health"
Expand Down
3 changes: 2 additions & 1 deletion pkg/models/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package models

import (
"context"
"github.com/EinStack/glide/pkg/provider"
"io"
"time"

"github.com/EinStack/glide/pkg/provider"

"github.com/EinStack/glide/pkg/clients"
health2 "github.com/EinStack/glide/pkg/resiliency/health"

Expand Down
6 changes: 2 additions & 4 deletions pkg/providers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package providers
import (
"errors"
"fmt"
"strings"

"github.com/EinStack/glide/pkg/provider"
"github.com/go-playground/validator/v10"
"strings"

"gopkg.in/yaml.v3"

Expand Down Expand Up @@ -44,7 +45,6 @@ func (p DynLangProvider) ToClient(tel *telemetry.Telemetry, clientConfig *client

providerConfigUnmarshaller := func(providerConfig interface{}) error {
providerConfigBytes, err := yaml.Marshal(configValue)

if err != nil {
return err
}
Expand All @@ -53,7 +53,6 @@ func (p DynLangProvider) ToClient(tel *telemetry.Telemetry, clientConfig *client
}

err := providerConfig.UnmarshalYAML(providerConfigUnmarshaller)

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -105,7 +104,6 @@ func (p DynLangProvider) validate() error {
}

err = yaml.Unmarshal(providerConfigBytes, providerConfig)

if err != nil {
return err
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/providers/config_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package providers

import (
testprovider "github.com/EinStack/glide/pkg/providers/testing"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
"os"
"path/filepath"
"testing"

testprovider "github.com/EinStack/glide/pkg/providers/testing"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)

func TestDynLangProvider(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/providers/openai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/EinStack/glide/pkg/clients"
"github.com/EinStack/glide/pkg/config/fields"
"github.com/EinStack/glide/pkg/provider"
"github.com/EinStack/glide/pkg/providers"
"github.com/EinStack/glide/pkg/telemetry"
)

Expand Down Expand Up @@ -53,7 +52,7 @@ type Config struct {
DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"`
}

var _ providers.ProviderConfig = (*Config)(nil)
var _ provider.ProviderConfig = (*Config)(nil)

// DefaultConfig for OpenAI models
func DefaultConfig() *Config {
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package providers

import (
"fmt"

"github.com/EinStack/glide/pkg/provider"
)

Expand Down Expand Up @@ -34,7 +35,7 @@ func (r *ProviderRegistry) Get(name provider.ProviderID) (provider.ProviderConfi
func (r *ProviderRegistry) Available() []provider.ProviderID {
available := make([]provider.ProviderID, 0, len(r.providers))

for providerID, _ := range r.providers {
for providerID := range r.providers {
available = append(available, providerID)
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/routers/lang/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package lang

import (
"fmt"
"github.com/EinStack/glide/pkg/providers"
"time"

"github.com/EinStack/glide/pkg/providers"

"github.com/EinStack/glide/pkg/routers"

"github.com/EinStack/glide/pkg/models"
Expand All @@ -16,7 +17,7 @@ import (
)

type (
ModelConfig = models.Config[providers.DynLangProvider]
ModelConfig = models.Config[*providers.DynLangProvider]
ModelPoolConfig = []ModelConfig
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/routers/lang/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestRouterConfig_BuildModels(t *testing.T) {
Client: clients.DefaultClientConfig(),
ErrorBudget: health.DefaultErrorBudget(),
Latency: latency.DefaultConfig(),
Provider: providers.DynLangProvider{
Provider: &providers.DynLangProvider{
openai.ProviderOpenAI: &openai.Config{
APIKey: "ABC",
DefaultParams: &defaultParams,
Expand All @@ -45,7 +45,7 @@ func TestRouterConfig_BuildModels(t *testing.T) {
Client: clients.DefaultClientConfig(),
ErrorBudget: health.DefaultErrorBudget(),
Latency: latency.DefaultConfig(),
Provider: providers.DynLangProvider{
Provider: &providers.DynLangProvider{
openai.ProviderOpenAI: &openai.Config{
APIKey: "ABC",
DefaultParams: &defaultParams,
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestRouterConfig_BuildModelsPerType(t *testing.T) {
Client: clients.DefaultClientConfig(),
ErrorBudget: health.DefaultErrorBudget(),
Latency: latency.DefaultConfig(),
Provider: providers.DynLangProvider{
Provider: &providers.DynLangProvider{
openai.ProviderOpenAI: &openai.Config{
APIKey: "ABC",
DefaultParams: &openAIParams,
Expand Down
3 changes: 2 additions & 1 deletion pkg/routers/lang/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package lang

import (
"context"
ptesting "github.com/EinStack/glide/pkg/providers/testing"
"testing"
"time"

ptesting "github.com/EinStack/glide/pkg/providers/testing"

"github.com/EinStack/glide/pkg/models"

"github.com/EinStack/glide/pkg/clients"
Expand Down
3 changes: 2 additions & 1 deletion pkg/routers/routing/least_latency_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package routing

import (
ptesting "github.com/EinStack/glide/pkg/providers/testing"
"strconv"
"testing"
"time"

ptesting "github.com/EinStack/glide/pkg/providers/testing"

"github.com/EinStack/glide/pkg/models"

"github.com/stretchr/testify/require"
Expand Down
3 changes: 2 additions & 1 deletion pkg/routers/routing/priority_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package routing

import (
ptesting "github.com/EinStack/glide/pkg/providers/testing"
"testing"

ptesting "github.com/EinStack/glide/pkg/providers/testing"

"github.com/EinStack/glide/pkg/models"

"github.com/stretchr/testify/require"
Expand Down
3 changes: 2 additions & 1 deletion pkg/routers/routing/round_robin_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package routing

import (
ptesting "github.com/EinStack/glide/pkg/providers/testing"
"testing"

ptesting "github.com/EinStack/glide/pkg/providers/testing"

"github.com/EinStack/glide/pkg/models"

"github.com/stretchr/testify/require"
Expand Down
3 changes: 2 additions & 1 deletion pkg/routers/routing/weighted_round_robin_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package routing

import (
ptesting "github.com/EinStack/glide/pkg/providers/testing"
"testing"

ptesting "github.com/EinStack/glide/pkg/providers/testing"

"github.com/EinStack/glide/pkg/models"

"github.com/stretchr/testify/require"
Expand Down

0 comments on commit e043e4d

Please sign in to comment.