@jambonz/llm 0.6.2 → 0.6.3
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 +51 -38
- 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 +51 -38
- package/dist/index.js.map +1 -1
- package/dist/test-kit/index.cjs +104 -40
- package/dist/test-kit/index.cjs.map +1 -1
- package/dist/test-kit/index.d.cts +2 -2
- package/dist/test-kit/index.d.ts +2 -2
- package/dist/test-kit/index.js +104 -40
- package/dist/test-kit/index.js.map +1 -1
- package/dist/{types-Y0o6rN3B.d.cts → types-dbgrfviJ.d.cts} +7 -1
- package/dist/{types-Y0o6rN3B.d.ts → types-dbgrfviJ.d.ts} +7 -1
- 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-dbgrfviJ.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-dbgrfviJ.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-dbgrfviJ.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-dbgrfviJ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The loose "DB-shape" input accepted by `normalizeAuth`.
|
package/dist/index.js
CHANGED
|
@@ -239,10 +239,11 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
239
239
|
}
|
|
240
240
|
yield endEvent;
|
|
241
241
|
}
|
|
242
|
-
function appendOpenAIAssistantToolCall(history, toolCalls) {
|
|
242
|
+
function appendOpenAIAssistantToolCall(history, toolCalls, assistantText) {
|
|
243
|
+
const text = assistantText?.trim() ? assistantText : null;
|
|
243
244
|
const wireMessage = {
|
|
244
245
|
role: "assistant",
|
|
245
|
-
content:
|
|
246
|
+
content: text,
|
|
246
247
|
tool_calls: toolCalls.map((tc) => ({
|
|
247
248
|
id: tc.id,
|
|
248
249
|
type: "function",
|
|
@@ -256,7 +257,7 @@ function appendOpenAIAssistantToolCall(history, toolCalls) {
|
|
|
256
257
|
...history,
|
|
257
258
|
{
|
|
258
259
|
role: "assistant",
|
|
259
|
-
content: "",
|
|
260
|
+
content: text ?? "",
|
|
260
261
|
vendorRaw: wireMessage
|
|
261
262
|
}
|
|
262
263
|
];
|
|
@@ -527,8 +528,8 @@ var OpenAIAdapter = class {
|
|
|
527
528
|
includeCacheKey: this.forwardCacheKey()
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
531
|
-
return appendOpenAIAssistantToolCall(history, toolCalls);
|
|
531
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
532
|
+
return appendOpenAIAssistantToolCall(history, toolCalls, assistantText);
|
|
532
533
|
}
|
|
533
534
|
appendToolResult(history, toolCallId, result) {
|
|
534
535
|
return appendOpenAIToolResult(history, toolCallId, result);
|
|
@@ -1494,21 +1495,25 @@ var AnthropicAdapter = class {
|
|
|
1494
1495
|
}
|
|
1495
1496
|
yield endEvent;
|
|
1496
1497
|
}
|
|
1497
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
1498
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
1499
|
+
const text = assistantText?.trim() ? assistantText : null;
|
|
1498
1500
|
const wireMessage = {
|
|
1499
1501
|
role: "assistant",
|
|
1500
|
-
content:
|
|
1501
|
-
type: "
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1502
|
+
content: [
|
|
1503
|
+
...text ? [{ type: "text", text }] : [],
|
|
1504
|
+
...toolCalls.map((tc) => ({
|
|
1505
|
+
type: "tool_use",
|
|
1506
|
+
id: tc.id,
|
|
1507
|
+
name: tc.name,
|
|
1508
|
+
input: tc.arguments ?? {}
|
|
1509
|
+
}))
|
|
1510
|
+
]
|
|
1506
1511
|
};
|
|
1507
1512
|
return [
|
|
1508
1513
|
...history,
|
|
1509
1514
|
{
|
|
1510
1515
|
role: "assistant",
|
|
1511
|
-
content: "",
|
|
1516
|
+
content: text ?? "",
|
|
1512
1517
|
vendorRaw: wireMessage
|
|
1513
1518
|
}
|
|
1514
1519
|
];
|
|
@@ -1760,21 +1765,25 @@ async function* streamFromGemini(client, req) {
|
|
|
1760
1765
|
};
|
|
1761
1766
|
yield endEvent;
|
|
1762
1767
|
}
|
|
1763
|
-
function appendGeminiAssistantToolCall(history, toolCalls) {
|
|
1768
|
+
function appendGeminiAssistantToolCall(history, toolCalls, assistantText) {
|
|
1769
|
+
const text = assistantText?.trim() ? assistantText : null;
|
|
1764
1770
|
const wireMessage = {
|
|
1765
1771
|
role: "model",
|
|
1766
|
-
parts:
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
+
parts: [
|
|
1773
|
+
...text ? [{ text }] : [],
|
|
1774
|
+
...toolCalls.map((tc) => ({
|
|
1775
|
+
functionCall: {
|
|
1776
|
+
name: parseToolName(tc.id),
|
|
1777
|
+
args: tc.arguments ?? {}
|
|
1778
|
+
}
|
|
1779
|
+
}))
|
|
1780
|
+
]
|
|
1772
1781
|
};
|
|
1773
1782
|
return [
|
|
1774
1783
|
...history,
|
|
1775
1784
|
{
|
|
1776
1785
|
role: "assistant",
|
|
1777
|
-
content: "",
|
|
1786
|
+
content: text ?? "",
|
|
1778
1787
|
vendorRaw: wireMessage
|
|
1779
1788
|
}
|
|
1780
1789
|
];
|
|
@@ -2034,8 +2043,8 @@ var GoogleAdapter = class {
|
|
|
2034
2043
|
stream(req) {
|
|
2035
2044
|
return streamFromGemini(this.ensureClient(), req);
|
|
2036
2045
|
}
|
|
2037
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
2038
|
-
return appendGeminiAssistantToolCall(history, toolCalls);
|
|
2046
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
2047
|
+
return appendGeminiAssistantToolCall(history, toolCalls, assistantText);
|
|
2039
2048
|
}
|
|
2040
2049
|
appendToolResult(history, toolCallId, result) {
|
|
2041
2050
|
return appendGeminiToolResult(history, toolCallId, result);
|
|
@@ -2240,8 +2249,8 @@ var VertexGeminiAdapter = class {
|
|
|
2240
2249
|
stream(req) {
|
|
2241
2250
|
return streamFromGemini(this.ensureClient(), req);
|
|
2242
2251
|
}
|
|
2243
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
2244
|
-
return appendGeminiAssistantToolCall(history, toolCalls);
|
|
2252
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
2253
|
+
return appendGeminiAssistantToolCall(history, toolCalls, assistantText);
|
|
2245
2254
|
}
|
|
2246
2255
|
appendToolResult(history, toolCallId, result) {
|
|
2247
2256
|
return appendGeminiToolResult(history, toolCallId, result);
|
|
@@ -2438,8 +2447,8 @@ var VertexOpenAIAdapter = class {
|
|
|
2438
2447
|
vendorMetadataExtractor: VERTEX_OPENAI_METADATA_EXTRACTOR
|
|
2439
2448
|
});
|
|
2440
2449
|
}
|
|
2441
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
2442
|
-
return appendOpenAIAssistantToolCall(history, toolCalls);
|
|
2450
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
2451
|
+
return appendOpenAIAssistantToolCall(history, toolCalls, assistantText);
|
|
2443
2452
|
}
|
|
2444
2453
|
appendToolResult(history, toolCallId, result) {
|
|
2445
2454
|
return appendOpenAIToolResult(history, toolCallId, result);
|
|
@@ -2931,22 +2940,26 @@ var BedrockAdapter = class {
|
|
|
2931
2940
|
}
|
|
2932
2941
|
yield endEvent;
|
|
2933
2942
|
}
|
|
2934
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
2943
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
2944
|
+
const text = assistantText?.trim() ? assistantText : null;
|
|
2935
2945
|
const wireMessage = {
|
|
2936
2946
|
role: "assistant",
|
|
2937
|
-
content:
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2947
|
+
content: [
|
|
2948
|
+
...text ? [{ text }] : [],
|
|
2949
|
+
...toolCalls.map((tc) => ({
|
|
2950
|
+
toolUse: {
|
|
2951
|
+
toolUseId: tc.id,
|
|
2952
|
+
name: tc.name,
|
|
2953
|
+
input: tc.arguments ?? {}
|
|
2954
|
+
}
|
|
2955
|
+
}))
|
|
2956
|
+
]
|
|
2944
2957
|
};
|
|
2945
2958
|
return [
|
|
2946
2959
|
...history,
|
|
2947
2960
|
{
|
|
2948
2961
|
role: "assistant",
|
|
2949
|
-
content: "",
|
|
2962
|
+
content: text ?? "",
|
|
2950
2963
|
vendorRaw: wireMessage
|
|
2951
2964
|
}
|
|
2952
2965
|
];
|
|
@@ -3236,8 +3249,8 @@ var AzureOpenAIAdapter = class {
|
|
|
3236
3249
|
vendorMetadataExtractor: AZURE_OPENAI_METADATA_EXTRACTOR
|
|
3237
3250
|
});
|
|
3238
3251
|
}
|
|
3239
|
-
appendAssistantToolCall(history, toolCalls) {
|
|
3240
|
-
return appendOpenAIAssistantToolCall(history, toolCalls);
|
|
3252
|
+
appendAssistantToolCall(history, toolCalls, assistantText) {
|
|
3253
|
+
return appendOpenAIAssistantToolCall(history, toolCalls, assistantText);
|
|
3241
3254
|
}
|
|
3242
3255
|
appendToolResult(history, toolCallId, result) {
|
|
3243
3256
|
return appendOpenAIToolResult(history, toolCallId, result);
|