From 300b4f33f23c5955bc06320c4b4926016359dec5 Mon Sep 17 00:00:00 2001 From: Nurali Techie Date: Sun, 2 Feb 2025 00:01:21 +0530 Subject: [PATCH] refator: request validation config changed to disable --- client/client.go | 8 ++++---- config/config.go | 6 +++--- deepseek.go | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/client/client.go b/client/client.go index f361325..b675c1b 100644 --- a/client/client.go +++ b/client/client.go @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/config/config.go b/config/config.go index 6a51150..ceae459 100644 --- a/config/config.go +++ b/config/config.go @@ -1,7 +1,7 @@ package config type Config struct { - ApiKey string - TimeoutSeconds int - EnableRequestValidation bool + ApiKey string + TimeoutSeconds int + DisableRequestValidation bool } diff --git a/deepseek.go b/deepseek.go index 038828f..dd9f79b 100644 --- a/deepseek.go +++ b/deepseek.go @@ -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) }