@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.
package/dist/index.cjs CHANGED
@@ -117,14 +117,15 @@ async function* streamFromOpenAI(client, req, options) {
117
117
  model: req.model,
118
118
  messages,
119
119
  stream: true,
120
- stream_options: { include_usage: true }
120
+ ...options.includeStreamOptions !== false ? { stream_options: { include_usage: true } } : {}
121
121
  };
122
122
  if (tools) {
123
123
  body.tools = tools;
124
124
  body.tool_choice = "auto";
125
125
  }
126
126
  if (req.temperature !== void 0) body.temperature = req.temperature;
127
- if (req.maxTokens !== void 0) body.max_tokens = req.maxTokens;
127
+ const effectiveMaxTokens = req.maxTokens ?? options.defaultMaxTokens;
128
+ if (effectiveMaxTokens !== void 0) body.max_tokens = effectiveMaxTokens;
128
129
  let stream;
129
130
  try {
130
131
  stream = await client.chat.completions.create(body, { signal: req.signal });
@@ -1631,7 +1632,8 @@ var VertexOpenAIAdapter = class {
1631
1632
  }
1632
1633
  stream(req) {
1633
1634
  return streamFromOpenAI(this.ensureClient(), req, {
1634
- knownModels: vertexOpenAIManifest.knownModels
1635
+ knownModels: vertexOpenAIManifest.knownModels,
1636
+ defaultMaxTokens: 4096
1635
1637
  });
1636
1638
  }
1637
1639
  appendAssistantToolCall(history, toolCalls) {