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.
Files changed (2) hide show
  1. package/dist/api.js +6 -6
  2. 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
- // Ensure max_tokens is set to a high value to avoid truncation
30
- // We'll use a consistent property name maxTokens throughout the code
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "call-ai",
3
- "version": "0.8.5-dev-preview.2",
3
+ "version": "0.8.5-dev-preview.3",
4
4
  "description": "Lightweight library for making AI API calls with streaming support",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist/index.js",