call-ai 0.8.5-dev-preview.2 → 0.8.5-dev-preview.3
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/dist/api.js +6 -6
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -26,11 +26,8 @@ const FALLBACK_MODEL = "openrouter/auto";
|
|
|
26
26
|
function callAI(prompt, options = {}) {
|
|
27
27
|
// Check if we need to force streaming based on model strategy
|
|
28
28
|
const schemaStrategy = (0, strategies_1.chooseSchemaStrategy)(options.model, options.schema || null);
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
if (!options.maxTokens) {
|
|
32
|
-
options.maxTokens = 100000;
|
|
33
|
-
}
|
|
29
|
+
// We no longer set a default maxTokens
|
|
30
|
+
// Will only include max_tokens in the request if explicitly set by the user
|
|
34
31
|
// Handle special case: Claude with tools requires streaming
|
|
35
32
|
if (!options.stream && schemaStrategy.shouldForceStream) {
|
|
36
33
|
// Buffer streaming results into a single response
|
|
@@ -331,9 +328,12 @@ function prepareRequestParams(prompt, options) {
|
|
|
331
328
|
messages,
|
|
332
329
|
temperature: options.temperature !== undefined ? options.temperature : 0.7,
|
|
333
330
|
top_p: options.topP !== undefined ? options.topP : 1,
|
|
334
|
-
max_tokens: options.maxTokens || 2048,
|
|
335
331
|
stream: options.stream !== undefined ? options.stream : false,
|
|
336
332
|
};
|
|
333
|
+
// Only include max_tokens if explicitly set
|
|
334
|
+
if (options.maxTokens !== undefined) {
|
|
335
|
+
requestParams.max_tokens = options.maxTokens;
|
|
336
|
+
}
|
|
337
337
|
// Add optional parameters if specified
|
|
338
338
|
if (options.stop) {
|
|
339
339
|
// Handle both single string and array of stop sequences
|