@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.
@@ -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 });
@@ -1597,7 +1598,7 @@ var VertexOpenAIAdapter = class {
1597
1598
  if (!auth.location) {
1598
1599
  throw new Error("VertexOpenAIAdapter: location is required");
1599
1600
  }
1600
- const baseURL = `https://${auth.location}-aiplatform.googleapis.com/v1/projects/${auth.projectId}/locations/${auth.location}/endpoints/openapi`;
1601
+ const baseURL = `https://${auth.location}-aiplatform.googleapis.com/v1beta1/projects/${auth.projectId}/locations/${auth.location}/endpoints/openapi`;
1601
1602
  const googleAuth = new import_google_auth_library.GoogleAuth({
1602
1603
  credentials: auth.credentials,
1603
1604
  scopes: ["https://www.googleapis.com/auth/cloud-platform"]
@@ -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) {