@jambonz/llm 0.2.2 → 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 });
@@ -1558,7 +1559,7 @@ var VertexOpenAIAdapter = class {
1558
1559
  if (!auth.location) {
1559
1560
  throw new Error("VertexOpenAIAdapter: location is required");
1560
1561
  }
1561
- const baseURL = `https://${auth.location}-aiplatform.googleapis.com/v1/projects/${auth.projectId}/locations/${auth.location}/endpoints/openapi`;
1562
+ const baseURL = `https://${auth.location}-aiplatform.googleapis.com/v1beta1/projects/${auth.projectId}/locations/${auth.location}/endpoints/openapi`;
1562
1563
  const googleAuth = new GoogleAuth({
1563
1564
  credentials: auth.credentials,
1564
1565
  scopes: ["https://www.googleapis.com/auth/cloud-platform"]
@@ -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) {