@jambonz/llm 0.5.0 → 0.5.1
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 +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/test-kit/index.cjs +13 -0
- 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 +13 -0
- package/dist/test-kit/index.js.map +1 -1
- package/dist/{types-BWsmVtXv.d.cts → types-BEgQaQIb.d.cts} +23 -0
- package/dist/{types-BWsmVtXv.d.ts → types-BEgQaQIb.d.ts} +23 -0
- 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-BEgQaQIb.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-BEgQaQIb.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
|
@@ -78,6 +78,9 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
78
78
|
const param = options.tokensParam ?? (needsMaxCompletionTokens(req.model) ? "max_completion_tokens" : "max_tokens");
|
|
79
79
|
body[param] = effectiveMaxTokens;
|
|
80
80
|
}
|
|
81
|
+
const t0 = process.hrtime.bigint();
|
|
82
|
+
let t1;
|
|
83
|
+
let t2;
|
|
81
84
|
let stream;
|
|
82
85
|
let responseHeaders;
|
|
83
86
|
try {
|
|
@@ -90,6 +93,7 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
90
93
|
} else {
|
|
91
94
|
stream = await apiPromise;
|
|
92
95
|
}
|
|
96
|
+
t1 = process.hrtime.bigint();
|
|
93
97
|
} catch (err) {
|
|
94
98
|
if (isAbortError(err)) {
|
|
95
99
|
yield { type: "end", finishReason: "aborted" };
|
|
@@ -121,6 +125,7 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
121
125
|
const delta = choice.delta;
|
|
122
126
|
const finishReason = choice.finish_reason;
|
|
123
127
|
if (delta?.content) {
|
|
128
|
+
if (t2 === void 0) t2 = process.hrtime.bigint();
|
|
124
129
|
yield { type: "token", text: delta.content };
|
|
125
130
|
}
|
|
126
131
|
if (delta?.tool_calls) {
|
|
@@ -190,6 +195,14 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
190
195
|
endEvent.vendorMetadata = metadata;
|
|
191
196
|
}
|
|
192
197
|
}
|
|
198
|
+
if (t1 !== void 0) {
|
|
199
|
+
const t3 = process.hrtime.bigint();
|
|
200
|
+
endEvent.clientTiming = {
|
|
201
|
+
requestToHeadersMs: Number(t1 - t0) / 1e6,
|
|
202
|
+
...t2 !== void 0 ? { headersToFirstTokenMs: Number(t2 - t1) / 1e6 } : {},
|
|
203
|
+
totalMs: Number(t3 - t0) / 1e6
|
|
204
|
+
};
|
|
205
|
+
}
|
|
193
206
|
yield endEvent;
|
|
194
207
|
}
|
|
195
208
|
function appendOpenAIAssistantToolCall(history, toolCalls) {
|