diff --git a/pkg/providers/anthropic/config.go b/pkg/providers/anthropic/config.go index f04c0ca..139c4ad 100644 --- a/pkg/providers/anthropic/config.go +++ b/pkg/providers/anthropic/config.go @@ -36,12 +36,12 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"baseUrl" json:"baseUrl" validate:"required"` - APIVersion string `yaml:"apiVersion" json:"apiVersion" validate:"required"` - ChatEndpoint string `yaml:"chatEndpoint" json:"chatEndpoint" validate:"required"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required"` + APIVersion string `yaml:"api_version" json:"api_version" validate:"required"` + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint" validate:"required"` Model string `yaml:"model" json:"model" validate:"required"` APIKey fields.Secret `yaml:"api_key" json:"-" validate:"required"` - DefaultParams *Params `yaml:"defaultParams,omitempty" json:"defaultParams"` + DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"` } // DefaultConfig for OpenAI models diff --git a/pkg/providers/azureopenai/config.go b/pkg/providers/azureopenai/config.go index e1da2e6..b574954 100644 --- a/pkg/providers/azureopenai/config.go +++ b/pkg/providers/azureopenai/config.go @@ -20,7 +20,6 @@ type Params struct { Tools []string `yaml:"tools,omitempty" json:"tools"` ToolChoice interface{} `yaml:"tool_choice,omitempty" json:"tool_choice"` ResponseFormat interface{} `yaml:"response_format,omitempty" json:"response_format"` // TODO: should this be a part of the chat request API? - // Stream bool `json:"stream,omitempty"` // TODO: we are not supporting this at the moment } func DefaultParams() Params { @@ -43,12 +42,12 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"base_url" json:"baseUrl" validate:"required"` // The name of your Azure OpenAI Resource (e.g https://glide-test.openai.azure.com/) - ChatEndpoint string `yaml:"chat_endpoint" json:"chatEndpoint"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required"` // The name of your Azure OpenAI Resource (e.g https://glide-test.openai.azure.com/) + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint"` Model string `yaml:"model" json:"model" validate:"required"` // This is your deployment name. You're required to first deploy a model before you can make calls (e.g. glide-gpt-35) APIVersion string `yaml:"api_version" json:"apiVersion" validate:"required"` // The API version to use for this operation. This follows the YYYY-MM-DD format (e.g 2023-05-15) APIKey fields.Secret `yaml:"api_key" json:"-" validate:"required"` - DefaultParams *Params `yaml:"default_params,omitempty" json:"defaultParams"` + DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"` } // DefaultConfig for OpenAI models diff --git a/pkg/providers/bedrock/config.go b/pkg/providers/bedrock/config.go index 58fc17f..5d552a0 100644 --- a/pkg/providers/bedrock/config.go +++ b/pkg/providers/bedrock/config.go @@ -31,14 +31,14 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"baseUrl" json:"baseUrl" validate:"required"` - ChatEndpoint string `yaml:"chatEndpoint" json:"chatEndpoint" validate:"required"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required"` + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint" validate:"required"` Model string `yaml:"model" json:"model" validate:"required"` APIKey fields.Secret `yaml:"api_key" json:"-" validate:"required"` AccessKey string `yaml:"access_key" json:"-" validate:"required"` SecretKey string `yaml:"secret_key" json:"-" validate:"required"` AWSRegion string `yaml:"aws_region" json:"awsRegion" validate:"required"` - DefaultParams *Params `yaml:"defaultParams,omitempty" json:"defaultParams"` + DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"` } // DefaultConfig for OpenAI models diff --git a/pkg/providers/cohere/config.go b/pkg/providers/cohere/config.go index 233db54..672a27a 100644 --- a/pkg/providers/cohere/config.go +++ b/pkg/providers/cohere/config.go @@ -39,8 +39,8 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"base_url" json:"baseUrl" validate:"required,http_url"` - ChatEndpoint string `yaml:"chat_endpoint" json:"chatEndpoint" validate:"required"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required,http_url"` + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint" validate:"required"` Model string `yaml:"model" json:"model" validate:"required"` // https://docs.cohere.com/docs/models#command APIKey fields.Secret `yaml:"api_key" json:"-" validate:"required"` DefaultParams *Params `yaml:"default_params,omitempty" json:"defaultParams"` diff --git a/pkg/providers/octoml/config.go b/pkg/providers/octoml/config.go index 609b5cd..6c257d6 100644 --- a/pkg/providers/octoml/config.go +++ b/pkg/providers/octoml/config.go @@ -13,7 +13,6 @@ type Params struct { StopWords []string `yaml:"stop,omitempty" json:"stop"` FrequencyPenalty int `yaml:"frequency_penalty,omitempty" json:"frequency_penalty"` PresencePenalty int `yaml:"presence_penalty,omitempty" json:"presence_penalty"` - // Stream bool `json:"stream,omitempty"` // TODO: we are not supporting this at the moment } func DefaultParams() Params { @@ -34,11 +33,11 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"base_url" json:"baseUrl" validate:"required"` - ChatEndpoint string `yaml:"chat_endpoint" json:"chatEndpoint" validate:"required"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required"` + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint" validate:"required"` Model string `yaml:"model" json:"model" validate:"required"` APIKey fields.Secret `yaml:"api_key" json:"-" validate:"required"` - DefaultParams *Params `yaml:"default_params,omitempty" json:"defaultParams"` + DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"` } // DefaultConfig for OctoML models diff --git a/pkg/providers/ollama/config.go b/pkg/providers/ollama/config.go index 7363db5..27db53f 100644 --- a/pkg/providers/ollama/config.go +++ b/pkg/providers/ollama/config.go @@ -40,10 +40,10 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"baseUrl" json:"baseUrl" validate:"required"` - ChatEndpoint string `yaml:"chatEndpoint" json:"chatEndpoint" validate:"required"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required"` + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint" validate:"required"` Model string `yaml:"model" json:"model" validate:"required"` - DefaultParams *Params `yaml:"defaultParams,omitempty" json:"defaultParams"` + DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"` } // DefaultConfig for OpenAI models diff --git a/pkg/providers/openai/chat.go b/pkg/providers/openai/chat.go index 323cd84..5766cbf 100644 --- a/pkg/providers/openai/chat.go +++ b/pkg/providers/openai/chat.go @@ -116,6 +116,11 @@ func (c *Client) doChatRequest(ctx context.Context, payload *ChatRequest) (*sche // Parse the response JSON var chatCompletion ChatCompletion + c.logger.Debug( + "Raw chat response", + zap.ByteString("resp", bodyBytes), + ) + err = json.Unmarshal(bodyBytes, &chatCompletion) if err != nil { c.logger.Error( diff --git a/pkg/providers/openai/config.go b/pkg/providers/openai/config.go index 2b95b0a..a76add1 100644 --- a/pkg/providers/openai/config.go +++ b/pkg/providers/openai/config.go @@ -42,11 +42,11 @@ func (p *Params) UnmarshalYAML(unmarshal func(interface{}) error) error { } type Config struct { - BaseURL string `yaml:"baseUrl" json:"baseUrl" validate:"required"` - ChatEndpoint string `yaml:"chatEndpoint" json:"chatEndpoint" validate:"required"` + BaseURL string `yaml:"base_url" json:"base_url" validate:"required"` + ChatEndpoint string `yaml:"chat_endpoint" json:"chat_endpoint" validate:"required"` Model string `yaml:"model" json:"model" validate:"required"` APIKey fields.Secret `yaml:"api_key" json:"-" validate:"required"` - DefaultParams *Params `yaml:"defaultParams,omitempty" json:"defaultParams"` + DefaultParams *Params `yaml:"default_params,omitempty" json:"default_params"` } // DefaultConfig for OpenAI models