@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.
@@ -105,14 +105,15 @@ async function* streamFromOpenAI(client, req, options) {
105
105
  model: req.model,
106
106
  messages,
107
107
  stream: true,
108
- stream_options: { include_usage: true }
108
+ ...options.includeStreamOptions !== false ? { stream_options: { include_usage: true } } : {}
109
109
  };
110
110
  if (tools) {
111
111
  body.tools = tools;
112
112
  body.tool_choice = "auto";
113
113
  }
114
114
  if (req.temperature !== void 0) body.temperature = req.temperature;
115
- if (req.maxTokens !== void 0) body.max_tokens = req.maxTokens;
115
+ const effectiveMaxTokens = req.maxTokens ?? options.defaultMaxTokens;
116
+ if (effectiveMaxTokens !== void 0) body.max_tokens = effectiveMaxTokens;
116
117
  let stream;
117
118
  try {
118
119
  stream = await client.chat.completions.create(body, { signal: req.signal });
@@ -1619,7 +1620,8 @@ var VertexOpenAIAdapter = class {
1619
1620
  }
1620
1621
  stream(req) {
1621
1622
  return streamFromOpenAI(this.ensureClient(), req, {
1622
- knownModels: vertexOpenAIManifest.knownModels
1623
+ knownModels: vertexOpenAIManifest.knownModels,
1624
+ defaultMaxTokens: 4096
1623
1625
  });
1624
1626
  }
1625
1627
  appendAssistantToolCall(history, toolCalls) {