@jambonz/llm 0.4.0 → 0.4.2
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 +23 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/test-kit/index.cjs +23 -6
- package/dist/test-kit/index.cjs.map +1 -1
- package/dist/test-kit/index.d.cts +1 -1
- package/dist/test-kit/index.d.ts +1 -1
- package/dist/test-kit/index.js +23 -6
- package/dist/test-kit/index.js.map +1 -1
- package/dist/{types-DxknK0Rc.d.cts → types-DbqWrdT6.d.cts} +1 -1
- package/dist/{types-DxknK0Rc.d.ts → types-DbqWrdT6.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-
|
|
1
|
+
import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-DbqWrdT6.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Named scenarios the harness must be able to stage. Each scenario configures
|
package/dist/test-kit/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-
|
|
1
|
+
import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-DbqWrdT6.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Named scenarios the harness must be able to stage. Each scenario configures
|
package/dist/test-kit/index.js
CHANGED
|
@@ -74,7 +74,10 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
74
74
|
}
|
|
75
75
|
if (req.temperature !== void 0) body.temperature = req.temperature;
|
|
76
76
|
const effectiveMaxTokens = req.maxTokens ?? options.defaultMaxTokens;
|
|
77
|
-
if (effectiveMaxTokens !== void 0)
|
|
77
|
+
if (effectiveMaxTokens !== void 0) {
|
|
78
|
+
const param = options.tokensParam ?? (needsMaxCompletionTokens(req.model) ? "max_completion_tokens" : "max_tokens");
|
|
79
|
+
body[param] = effectiveMaxTokens;
|
|
80
|
+
}
|
|
78
81
|
let stream;
|
|
79
82
|
try {
|
|
80
83
|
stream = await client.chat.completions.create(body, { signal: req.signal });
|
|
@@ -257,6 +260,9 @@ function capabilitiesFor(modelId, knownModels) {
|
|
|
257
260
|
if (known) return known.capabilities;
|
|
258
261
|
return defaultCapabilitiesForUnknown(modelId);
|
|
259
262
|
}
|
|
263
|
+
function needsMaxCompletionTokens(modelId) {
|
|
264
|
+
return /^(o\d|gpt-5)/i.test(modelId);
|
|
265
|
+
}
|
|
260
266
|
function defaultCapabilitiesForUnknown(modelId) {
|
|
261
267
|
const isReasoning = /^o[13]([-/]|$)/i.test(modelId);
|
|
262
268
|
if (isReasoning) {
|
|
@@ -1634,7 +1640,12 @@ var VertexOpenAIAdapter = class {
|
|
|
1634
1640
|
stream(req) {
|
|
1635
1641
|
return streamFromOpenAI(this.ensureClient(), req, {
|
|
1636
1642
|
knownModels: vertexOpenAIManifest.knownModels,
|
|
1637
|
-
defaultMaxTokens: 4096
|
|
1643
|
+
defaultMaxTokens: 4096,
|
|
1644
|
+
// Pin legacy `max_tokens`: Vertex's OpenAI-compat partner-model
|
|
1645
|
+
// endpoint predates `max_completion_tokens` and may not recognize it.
|
|
1646
|
+
// The model-id heuristic wouldn't catch a partner model named in the
|
|
1647
|
+
// OpenAI style (unlikely today, but defensive).
|
|
1648
|
+
tokensParam: "max_tokens"
|
|
1638
1649
|
});
|
|
1639
1650
|
}
|
|
1640
1651
|
appendAssistantToolCall(history, toolCalls) {
|
|
@@ -2334,8 +2345,8 @@ var azureOpenAIManifest = {
|
|
|
2334
2345
|
label: "API Version",
|
|
2335
2346
|
type: "text",
|
|
2336
2347
|
required: true,
|
|
2337
|
-
default: "
|
|
2338
|
-
help: "Data-plane api-version, e.g.
|
|
2348
|
+
default: "2025-03-01-preview",
|
|
2349
|
+
help: "Data-plane api-version, e.g. 2025-03-01-preview. Microsoft rolls these frequently; newer gpt-5 / o-series deployments require an api-version that supports the Responses API (2025-03-01-preview or later). See Azure OpenAI API reference docs for the current recommended version."
|
|
2339
2350
|
}
|
|
2340
2351
|
]
|
|
2341
2352
|
}
|
|
@@ -2382,7 +2393,8 @@ var AzureOpenAIAdapter = class {
|
|
|
2382
2393
|
}
|
|
2383
2394
|
stream(req) {
|
|
2384
2395
|
return streamFromOpenAI(this.ensureClient(), req, {
|
|
2385
|
-
knownModels: azureOpenAIManifest.knownModels
|
|
2396
|
+
knownModels: azureOpenAIManifest.knownModels,
|
|
2397
|
+
tokensParam: "max_completion_tokens"
|
|
2386
2398
|
});
|
|
2387
2399
|
}
|
|
2388
2400
|
appendAssistantToolCall(history, toolCalls) {
|
|
@@ -2401,7 +2413,12 @@ var AzureOpenAIAdapter = class {
|
|
|
2401
2413
|
// still requires it as a parameter.
|
|
2402
2414
|
model: "probe",
|
|
2403
2415
|
messages: [{ role: "user", content: "ping" }],
|
|
2404
|
-
max_tokens:
|
|
2416
|
+
// Use `max_completion_tokens` (not legacy `max_tokens`): gpt-5 family
|
|
2417
|
+
// and o-series reasoning models return 400 on the legacy parameter.
|
|
2418
|
+
// The newer name is a superset — also accepted by gpt-4o, gpt-4-turbo,
|
|
2419
|
+
// and gpt-3.5-turbo deployments — so it's the safe choice for a probe
|
|
2420
|
+
// that has to work regardless of the underlying deployment model.
|
|
2421
|
+
max_completion_tokens: 1,
|
|
2405
2422
|
stream: false
|
|
2406
2423
|
});
|
|
2407
2424
|
}
|