@semalt-ai/code 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/index.js +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -21,7 +21,6 @@ const DEFAULT_CONFIG = {
|
|
|
21
21
|
api_key: 'any',
|
|
22
22
|
default_model: 'default',
|
|
23
23
|
temperature: 0.7,
|
|
24
|
-
max_tokens: 4096,
|
|
25
24
|
request_timeout_ms: DEFAULT_API_TIMEOUT_MS,
|
|
26
25
|
stream: true,
|
|
27
26
|
models: [],
|
|
@@ -531,10 +530,13 @@ async function chatStream(messages, { model, temperature, maxTokens } = {}) {
|
|
|
531
530
|
model: model || config.default_model,
|
|
532
531
|
messages,
|
|
533
532
|
temperature: temperature !== undefined ? temperature : config.temperature,
|
|
534
|
-
max_tokens: maxTokens || config.max_tokens,
|
|
535
533
|
stream: true,
|
|
536
534
|
};
|
|
537
535
|
|
|
536
|
+
if (maxTokens !== undefined) {
|
|
537
|
+
payload.max_tokens = maxTokens;
|
|
538
|
+
}
|
|
539
|
+
|
|
538
540
|
const body = JSON.stringify(payload);
|
|
539
541
|
let res;
|
|
540
542
|
|
|
@@ -633,7 +635,6 @@ async function chatSync(messages, { model } = {}) {
|
|
|
633
635
|
model: model || config.default_model,
|
|
634
636
|
messages,
|
|
635
637
|
temperature: config.temperature,
|
|
636
|
-
max_tokens: config.max_tokens,
|
|
637
638
|
stream: false,
|
|
638
639
|
};
|
|
639
640
|
|
|
@@ -1130,7 +1131,7 @@ function cmdInit(opts) {
|
|
|
1130
1131
|
api_key: opts.apiKey || 'any',
|
|
1131
1132
|
default_model: opts.defaultModel || 'default',
|
|
1132
1133
|
temperature: 0.7,
|
|
1133
|
-
|
|
1134
|
+
request_timeout_ms: DEFAULT_API_TIMEOUT_MS,
|
|
1134
1135
|
stream: true,
|
|
1135
1136
|
models: config.models,
|
|
1136
1137
|
};
|