Skip to content

Commit

Permalink
#15: Import OpenAI provider configuration and update BuildAPIRequest …
Browse files Browse the repository at this point in the history
…function
  • Loading branch information
mkrueger12 committed Dec 12, 2023
1 parent 86c198b commit 09c3ceb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions pkg/buildAPIRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ import (
"github.com/go-playground/validator/v10"
"fmt"
"glide/pkg/providers"
"glide/pkg/providers/openai"
)

type ProviderConfigs = pkg.ProviderConfigs

// TODO: import provider configs to the config list
// Initialize configList

var configList = map[string]interface{}{
"openai": openai.OpenAIConfig,
}

// Create a new validator instance
var validate *validator.Validate = validator.New()


func BuildAPIRequest(provider string, params map[string]string, mode string, configList map[string]interface{}) (interface{}, error) {
func BuildAPIRequest(provider string, params map[string]string, mode string) (interface{}, error) {
// provider is the name of the provider, e.g. "openai", params is the map of parameters from the client,
// mode is the mode of the provider, e.g. "chat", configList is the list of provider configurations

Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/openai/api.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pkg
package openai

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/openai/chat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pkg
package openai

type ProviderConfig struct {
Model ConfigItem `json:"model" validate:"required,lowercase"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/openai/index.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pkg
package openai

import (
"glide/pkg/providers"
Expand Down

0 comments on commit 09c3ceb

Please sign in to comment.