Skip to content

Commit

Permalink
fix: Fix golang ci lints problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Andyyesiyu committed Jul 18, 2023
1 parent e340b0e commit dec4fa6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
1 change: 0 additions & 1 deletion chains/llm_azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/tmc/langchaingo/llms/openai"
"github.com/tmc/langchaingo/prompts"
)
Expand Down
11 changes: 2 additions & 9 deletions llms/openai/internal/openaiclient/openaiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,11 @@ func WithHTTPClient(client Doer) Option {
}
}

var azureMap = map[string]string{
"gpt-3.5-turbo": "gpt-35-turbo",
}

// New returns a new OpenAI client.
func New(token string, model string, baseURL string, organization string,
apiType APIType, apiVersion string,
opts ...Option) (*Client, error) {
opts ...Option,
) (*Client, error) {
c := &Client{
token: token,
Model: model,
Expand Down Expand Up @@ -134,9 +131,6 @@ func (c *Client) CreateEmbedding(ctx context.Context, r *EmbeddingRequest) ([][]
if r.Model == "" {
r.Model = defaultEmbeddingModel
}
if len(r.Input) <= 0 {
return nil, ErrEmptyResponse
}

resp, err := c.createEmbedding(ctx, &embeddingPayload{
Model: r.Model,
Expand Down Expand Up @@ -203,7 +197,6 @@ func (c *Client) buildURL(suffix string) string {
}

func (c *Client) buildAzureURL(suffix string) string {

baseURL := c.baseURL
baseURL = strings.TrimRight(baseURL, "/")

Expand Down
2 changes: 1 addition & 1 deletion llms/openai/openaillm.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func newAzureClient(opts ...Option) (*openaiclient.Client, error) {
baseURL: os.Getenv(baseURLEnvVarName),
organization: os.Getenv(organizationEnvVarName),
apiType: APITypeAzure,
apiVersion: DefaultApiVersion,
apiVersion: DefaultAPIVersion,
}

for _, opt := range opts {
Expand Down
14 changes: 7 additions & 7 deletions llms/openai/openaillm_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
)

const (
DefaultApiVersion = "2023-05-15"
DefaultAPIVersion = "2023-05-15"
)

type options struct {
Expand Down Expand Up @@ -64,17 +64,17 @@ func WithOrganization(organization string) Option {
}
}

// WithApiType passes the api type to the client. If not set, the default value
// is APITypeOpenAI
func WithApiType(apiType APIType) Option {
// WithAPIType passes the api type to the client. If not set, the default value
// is APITypeOpenAI.
func WithAPIType(apiType APIType) Option {
return func(opts *options) {
opts.apiType = apiType
}
}

// WithApiVersion passes the api version to the client. If not set, the default value
// is DefaultApiVersion
func WithApiVersion(apiVersion string) Option {
// WithAPIVersion passes the api version to the client. If not set, the default value
// is DefaultAPIVersion.
func WithAPIVersion(apiVersion string) Option {
return func(opts *options) {
opts.apiVersion = apiVersion
}
Expand Down

0 comments on commit dec4fa6

Please sign in to comment.