@jambonz/llm 0.2.3 → 0.2.4

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.
@@ -66,14 +66,15 @@ async function* streamFromOpenAI(client, req, options) {
66
66
  model: req.model,
67
67
  messages,
68
68
  stream: true,
69
- stream_options: { include_usage: true }
69
+ ...options.includeStreamOptions !== false ? { stream_options: { include_usage: true } } : {}
70
70
  };
71
71
  if (tools) {
72
72
  body.tools = tools;
73
73
  body.tool_choice = "auto";
74
74
  }
75
75
  if (req.temperature !== void 0) body.temperature = req.temperature;
76
- if (req.maxTokens !== void 0) body.max_tokens = req.maxTokens;
76
+ const effectiveMaxTokens = req.maxTokens ?? options.defaultMaxTokens;
77
+ if (effectiveMaxTokens !== void 0) body.max_tokens = effectiveMaxTokens;
77
78
  let stream;
78
79
  try {
79
80
  stream = await client.chat.completions.create(body, { signal: req.signal });
@@ -1580,7 +1581,8 @@ var VertexOpenAIAdapter = class {
1580
1581
  }
1581
1582
  stream(req) {
1582
1583
  return streamFromOpenAI(this.ensureClient(), req, {
1583
- knownModels: vertexOpenAIManifest.knownModels
1584
+ knownModels: vertexOpenAIManifest.knownModels,
1585
+ defaultMaxTokens: 4096
1584
1586
  });
1585
1587
  }
1586
1588
  appendAssistantToolCall(history, toolCalls) {