Skip to content

Commit

Permalink
refator: request validation config changed to disable
Browse files Browse the repository at this point in the history
  • Loading branch information
nurali-techie committed Feb 1, 2025
1 parent b7cd7cf commit 300b4f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (c *Client) CallChatCompletionsChat(chatReq *request.ChatCompletionsRequest
if chatReq.Model != "deepseek-chat" {
return nil, errors.New(`err: model should be "deepseek-chat"`)
}
if c.EnableRequestValidation {
if !c.DisableRequestValidation {
err := request.ValidateChatCompletionsRequest(chatReq)
if err != nil {
return nil, err
Expand Down Expand Up @@ -76,7 +76,7 @@ func (c *Client) StreamChatCompletionsChat(chatReq *request.ChatCompletionsReque
if chatReq.Model != "deepseek-chat" {
return nil, errors.New(`err: model should be "deepseek-chat"`)
}
if c.EnableRequestValidation {
if !c.DisableRequestValidation {
err := request.ValidateChatCompletionsRequest(chatReq)
if err != nil {
return nil, err
Expand All @@ -101,7 +101,7 @@ func (c *Client) CallChatCompletionsReasoner(chatReq *request.ChatCompletionsReq
if chatReq.Model != "deepseek-reasoner" {
return nil, errors.New(`err: model should be "deepseek-reasoner"`)
}
if c.EnableRequestValidation {
if !c.DisableRequestValidation {
err := request.ValidateChatCompletionsRequest(chatReq)
if err != nil {
return nil, err
Expand Down Expand Up @@ -132,7 +132,7 @@ func (c *Client) StreamChatCompletionsReasoner(chatReq *request.ChatCompletionsR
if chatReq.Model != "deepseek-reasoner" {
return nil, errors.New(`err: model should be "deepseek-reasoner"`)
}
if c.EnableRequestValidation {
if !c.DisableRequestValidation {
err := request.ValidateChatCompletionsRequest(chatReq)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package config

type Config struct {
ApiKey string
TimeoutSeconds int
EnableRequestValidation bool
ApiKey string
TimeoutSeconds int
DisableRequestValidation bool
}
5 changes: 2 additions & 3 deletions deepseek.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ type Client interface {

func NewClient(apiKey string) (Client, error) {
config := config.Config{
ApiKey: apiKey,
TimeoutSeconds: DEFAULT_TIMEOUT_SECONDS,
EnableRequestValidation: true,
ApiKey: apiKey,
TimeoutSeconds: DEFAULT_TIMEOUT_SECONDS,
}
return NewClientWithConfig(config)
}
Expand Down

0 comments on commit 300b4f3

Please sign in to comment.