Skip to content

Commit 6310c85

Browse files
committed
feat: added config default func
1 parent 56aac5f commit 6310c85

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

deepseek.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/go-deepseek/deepseek/response"
1010
)
1111

12-
const DEFAULT_TIMEOUT_SECONDS = 60
12+
const DEFAULT_TIMEOUT_SECONDS = 120
1313

1414
const (
1515
DEEPSEEK_CHAT_MODEL = "deepseek-chat"
@@ -37,16 +37,23 @@ type Client interface {
3737
PingChatCompletions(ctx context.Context, inputMessage string) (outputMessge string, err error)
3838
}
3939

40-
// NewClient creates deeseek client with given api key.
40+
// NewClient returns deeseek client which uses given deepseek API key.
4141
func NewClient(apiKey string) (Client, error) {
42-
config := config.Config{
43-
ApiKey: apiKey,
44-
TimeoutSeconds: DEFAULT_TIMEOUT_SECONDS,
45-
}
42+
config := NewConfigWithDefaults()
43+
config.ApiKey = apiKey
4644
return NewClientWithConfig(config)
4745
}
4846

49-
// NewClient creates deeseek client with given client config.
47+
// NewClient returns deeseek client with given client config.
5048
func NewClientWithConfig(config config.Config) (Client, error) {
5149
return client.NewClient(config)
5250
}
51+
52+
// NewConfigWithDefaults returns client config with default values.
53+
func NewConfigWithDefaults() config.Config {
54+
config := config.Config{
55+
TimeoutSeconds: DEFAULT_TIMEOUT_SECONDS,
56+
DisableRequestValidation: false,
57+
}
58+
return config
59+
}

deepseek_test/deepseek_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func GetApiKey() string {
2929
return DEEPSEEK_API_KEY
3030
}
3131

32-
func PingChatCompletions(t *testing.T) {
32+
func TestPingChatCompletions(t *testing.T) {
3333
client, err := deepseek.NewClient(GetApiKey())
3434
require.NoError(t, err)
3535

0 commit comments

Comments
 (0)