@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
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ServiceAccountJson, A as AuthSpec, a as AuthKindSchema, P as PromptRequest, b as AdapterFactory, c as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-
|
|
2
|
-
export { d as ApiKeyAuth, e as AuthKind, f as AzureOpenAIApiKeyAuth, B as BedrockApiKeyAuth, g as BedrockIamAuth, h as ClientOptions, i as ContentBlock, F as FinishReason, j as FormField, k as FormFieldType, G as GoogleApiKeyAuth, l as GoogleServiceAccountAuth, J as JsonSchema, m as LlmEvent, M as Message, n as ModelCapabilities, o as ModelInfo, R as Role, T as Tool, p as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-
|
|
1
|
+
import { S as ServiceAccountJson, A as AuthSpec, a as AuthKindSchema, P as PromptRequest, b as AdapterFactory, c as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-BEgQaQIb.cjs';
|
|
2
|
+
export { d as ApiKeyAuth, e as AuthKind, f as AzureOpenAIApiKeyAuth, B as BedrockApiKeyAuth, g as BedrockIamAuth, h as ClientOptions, i as ContentBlock, F as FinishReason, j as FormField, k as FormFieldType, G as GoogleApiKeyAuth, l as GoogleServiceAccountAuth, J as JsonSchema, m as LlmEvent, M as Message, n as ModelCapabilities, o as ModelInfo, R as Role, T as Tool, p as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-BEgQaQIb.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The loose "DB-shape" input accepted by `normalizeAuth`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ServiceAccountJson, A as AuthSpec, a as AuthKindSchema, P as PromptRequest, b as AdapterFactory, c as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-
|
|
2
|
-
export { d as ApiKeyAuth, e as AuthKind, f as AzureOpenAIApiKeyAuth, B as BedrockApiKeyAuth, g as BedrockIamAuth, h as ClientOptions, i as ContentBlock, F as FinishReason, j as FormField, k as FormFieldType, G as GoogleApiKeyAuth, l as GoogleServiceAccountAuth, J as JsonSchema, m as LlmEvent, M as Message, n as ModelCapabilities, o as ModelInfo, R as Role, T as Tool, p as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-
|
|
1
|
+
import { S as ServiceAccountJson, A as AuthSpec, a as AuthKindSchema, P as PromptRequest, b as AdapterFactory, c as AdapterManifest, C as CreateLlmArgs, L as LlmAdapter } from './types-BEgQaQIb.js';
|
|
2
|
+
export { d as ApiKeyAuth, e as AuthKind, f as AzureOpenAIApiKeyAuth, B as BedrockApiKeyAuth, g as BedrockIamAuth, h as ClientOptions, i as ContentBlock, F as FinishReason, j as FormField, k as FormFieldType, G as GoogleApiKeyAuth, l as GoogleServiceAccountAuth, J as JsonSchema, m as LlmEvent, M as Message, n as ModelCapabilities, o as ModelInfo, R as Role, T as Tool, p as ToolCallEvent, U as Usage, V as VertexServiceAccountAuth } from './types-BEgQaQIb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The loose "DB-shape" input accepted by `normalizeAuth`.
|
package/dist/index.js
CHANGED
|
@@ -85,6 +85,9 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
85
85
|
const param = options.tokensParam ?? (needsMaxCompletionTokens(req.model) ? "max_completion_tokens" : "max_tokens");
|
|
86
86
|
body[param] = effectiveMaxTokens;
|
|
87
87
|
}
|
|
88
|
+
const t0 = process.hrtime.bigint();
|
|
89
|
+
let t1;
|
|
90
|
+
let t2;
|
|
88
91
|
let stream;
|
|
89
92
|
let responseHeaders;
|
|
90
93
|
try {
|
|
@@ -97,6 +100,7 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
97
100
|
} else {
|
|
98
101
|
stream = await apiPromise;
|
|
99
102
|
}
|
|
103
|
+
t1 = process.hrtime.bigint();
|
|
100
104
|
} catch (err) {
|
|
101
105
|
if (isAbortError(err)) {
|
|
102
106
|
yield { type: "end", finishReason: "aborted" };
|
|
@@ -128,6 +132,7 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
128
132
|
const delta = choice.delta;
|
|
129
133
|
const finishReason = choice.finish_reason;
|
|
130
134
|
if (delta?.content) {
|
|
135
|
+
if (t2 === void 0) t2 = process.hrtime.bigint();
|
|
131
136
|
yield { type: "token", text: delta.content };
|
|
132
137
|
}
|
|
133
138
|
if (delta?.tool_calls) {
|
|
@@ -197,6 +202,14 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
197
202
|
endEvent.vendorMetadata = metadata;
|
|
198
203
|
}
|
|
199
204
|
}
|
|
205
|
+
if (t1 !== void 0) {
|
|
206
|
+
const t3 = process.hrtime.bigint();
|
|
207
|
+
endEvent.clientTiming = {
|
|
208
|
+
requestToHeadersMs: Number(t1 - t0) / 1e6,
|
|
209
|
+
...t2 !== void 0 ? { headersToFirstTokenMs: Number(t2 - t1) / 1e6 } : {},
|
|
210
|
+
totalMs: Number(t3 - t0) / 1e6
|
|
211
|
+
};
|
|
212
|
+
}
|
|
200
213
|
yield endEvent;
|
|
201
214
|
}
|
|
202
215
|
function appendOpenAIAssistantToolCall(history, toolCalls) {
|