|
9 | 9 | "github.com/go-deepseek/deepseek/response" |
10 | 10 | ) |
11 | 11 |
|
12 | | -const DEFAULT_TIMEOUT_SECONDS = 60 |
| 12 | +const DEFAULT_TIMEOUT_SECONDS = 120 |
13 | 13 |
|
14 | 14 | const ( |
15 | 15 | DEEPSEEK_CHAT_MODEL = "deepseek-chat" |
@@ -37,16 +37,23 @@ type Client interface { |
37 | 37 | PingChatCompletions(ctx context.Context, inputMessage string) (outputMessge string, err error) |
38 | 38 | } |
39 | 39 |
|
40 | | -// NewClient creates deeseek client with given api key. |
| 40 | +// NewClient returns deeseek client which uses given deepseek API key. |
41 | 41 | 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 |
46 | 44 | return NewClientWithConfig(config) |
47 | 45 | } |
48 | 46 |
|
49 | | -// NewClient creates deeseek client with given client config. |
| 47 | +// NewClient returns deeseek client with given client config. |
50 | 48 | func NewClientWithConfig(config config.Config) (Client, error) { |
51 | 49 | return client.NewClient(config) |
52 | 50 | } |
| 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 | +} |
0 commit comments