@adaptic/lumic-utils 1.0.13 → 1.0.15
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/{apollo-client.client-DU-axkDV.js → apollo-client.client-DLlWTxt5.js} +4 -4
- package/dist/{apollo-client.client-DU-axkDV.js.map → apollo-client.client-DLlWTxt5.js.map} +1 -1
- package/dist/{apollo-client.client-BXL45tI8.js → apollo-client.client-DcvDB-WD.js} +3 -3
- package/dist/{apollo-client.client-BXL45tI8.js.map → apollo-client.client-DcvDB-WD.js.map} +1 -1
- package/dist/{apollo-client.server-CsF1Ouw2.js → apollo-client.server-D9uTrgax.js} +3 -3
- package/dist/{apollo-client.server-CsF1Ouw2.js.map → apollo-client.server-D9uTrgax.js.map} +1 -1
- package/dist/{apollo-client.server-DsMOuLeH.js → apollo-client.server-DqSN1Fiy.js} +3 -3
- package/dist/{apollo-client.server-DsMOuLeH.js.map → apollo-client.server-DqSN1Fiy.js.map} +1 -1
- package/dist/{index-C01wYFKR.js → index-BD1cU0P8.js} +47 -42
- package/dist/{index-C01wYFKR.js.map → index-BD1cU0P8.js.map} +1 -1
- package/dist/{index-FzTQZ3fX.js → index-CwQjKm5M.js} +47 -42
- package/dist/{index-FzTQZ3fX.js.map → index-CwQjKm5M.js.map} +1 -1
- package/dist/{index-hlhvI_Sn.js → index-YK3guTNp.js} +2 -2
- package/dist/{index-hlhvI_Sn.js.map → index-YK3guTNp.js.map} +1 -1
- package/dist/{index-ChYbCXnO.js → index-b_XLaqK-.js} +2 -2
- package/dist/{index-ChYbCXnO.js.map → index-b_XLaqK-.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test.cjs +1 -1
- package/dist/test.mjs +1 -1
- package/package.json +1 -1
|
@@ -1894,7 +1894,7 @@ class LLMCostTracker {
|
|
|
1894
1894
|
timestamp: Date.now(),
|
|
1895
1895
|
};
|
|
1896
1896
|
this.usageRecords.push(record);
|
|
1897
|
-
getLumicLogger().
|
|
1897
|
+
getLumicLogger().info(`LLM cost tracked: ${provider}/${model} - $${cost.toFixed(6)}`, { provider, model, inputTokens, outputTokens, cost });
|
|
1898
1898
|
}
|
|
1899
1899
|
/**
|
|
1900
1900
|
* Records usage from an image generation call.
|
|
@@ -1911,7 +1911,7 @@ class LLMCostTracker {
|
|
|
1911
1911
|
timestamp: Date.now(),
|
|
1912
1912
|
};
|
|
1913
1913
|
this.imageRecords.push(record);
|
|
1914
|
-
getLumicLogger().
|
|
1914
|
+
getLumicLogger().info(`Image cost tracked: ${model} x${imageCount} - $${cost.toFixed(6)}`, { model, imageCount, cost });
|
|
1915
1915
|
}
|
|
1916
1916
|
/**
|
|
1917
1917
|
* Returns accumulated costs aggregated by model.
|
|
@@ -2350,14 +2350,15 @@ const makeOpenAIChatCompletionCall = async (content, responseFormat = 'text', op
|
|
|
2350
2350
|
getLLMCostTracker().trackUsage('openai', completion.model, completion.usage.prompt_tokens, completion.usage.completion_tokens);
|
|
2351
2351
|
// Handle tool calls differently
|
|
2352
2352
|
if (completion.tool_calls && completion.tool_calls.length > 0) {
|
|
2353
|
+
const toolCallResponse = {
|
|
2354
|
+
tool_calls: completion.tool_calls.map((tc) => ({
|
|
2355
|
+
id: tc.id,
|
|
2356
|
+
name: tc.function.name,
|
|
2357
|
+
arguments: JSON.parse(tc.function.arguments),
|
|
2358
|
+
})),
|
|
2359
|
+
};
|
|
2353
2360
|
return {
|
|
2354
|
-
response:
|
|
2355
|
-
tool_calls: completion.tool_calls.map((tc) => ({
|
|
2356
|
-
id: tc.id,
|
|
2357
|
-
name: tc.function.name,
|
|
2358
|
-
arguments: JSON.parse(tc.function.arguments),
|
|
2359
|
-
})),
|
|
2360
|
-
},
|
|
2361
|
+
response: toolCallResponse,
|
|
2361
2362
|
usage: {
|
|
2362
2363
|
prompt_tokens: completion.usage.prompt_tokens,
|
|
2363
2364
|
completion_tokens: completion.usage.completion_tokens,
|
|
@@ -2464,14 +2465,15 @@ const makeResponsesAPICall = async (input, options = {}) => {
|
|
|
2464
2465
|
}
|
|
2465
2466
|
// Handle tool calls differently
|
|
2466
2467
|
if (toolCalls && toolCalls.length > 0) {
|
|
2468
|
+
const toolCallResponse = {
|
|
2469
|
+
tool_calls: toolCalls.map((tc) => ({
|
|
2470
|
+
id: tc.id,
|
|
2471
|
+
name: tc.function.name,
|
|
2472
|
+
arguments: JSON.parse(tc.function.arguments),
|
|
2473
|
+
})),
|
|
2474
|
+
};
|
|
2467
2475
|
return {
|
|
2468
|
-
response:
|
|
2469
|
-
tool_calls: toolCalls.map((tc) => ({
|
|
2470
|
-
id: tc.id,
|
|
2471
|
-
name: tc.function.name,
|
|
2472
|
-
arguments: JSON.parse(tc.function.arguments),
|
|
2473
|
-
})),
|
|
2474
|
-
},
|
|
2476
|
+
response: toolCallResponse,
|
|
2475
2477
|
usage: {
|
|
2476
2478
|
prompt_tokens: response.usage?.input_tokens || 0,
|
|
2477
2479
|
completion_tokens: response.usage?.output_tokens || 0,
|
|
@@ -7973,14 +7975,15 @@ async function makeAnthropicCall(content, responseFormat = 'text', options = {})
|
|
|
7973
7975
|
arguments: JSON.stringify(block.input),
|
|
7974
7976
|
},
|
|
7975
7977
|
}));
|
|
7978
|
+
const toolCallResponse = {
|
|
7979
|
+
tool_calls: toolCalls.map((tc) => ({
|
|
7980
|
+
id: tc.id,
|
|
7981
|
+
name: tc.function.name,
|
|
7982
|
+
arguments: JSON.parse(tc.function.arguments),
|
|
7983
|
+
})),
|
|
7984
|
+
};
|
|
7976
7985
|
return {
|
|
7977
|
-
response:
|
|
7978
|
-
tool_calls: toolCalls.map((tc) => ({
|
|
7979
|
-
id: tc.id,
|
|
7980
|
-
name: tc.function.name,
|
|
7981
|
-
arguments: JSON.parse(tc.function.arguments),
|
|
7982
|
-
})),
|
|
7983
|
-
},
|
|
7986
|
+
response: toolCallResponse,
|
|
7984
7987
|
usage: {
|
|
7985
7988
|
prompt_tokens: inputTokens,
|
|
7986
7989
|
completion_tokens: outputTokens,
|
|
@@ -8160,14 +8163,15 @@ async function makeOpenAICompatibleCall(content, responseFormat = 'text', option
|
|
|
8160
8163
|
// Handle tool calls
|
|
8161
8164
|
const toolCalls = completion.choices[0]?.message?.tool_calls;
|
|
8162
8165
|
if (toolCalls && toolCalls.length > 0) {
|
|
8166
|
+
const toolCallResponse = {
|
|
8167
|
+
tool_calls: toolCalls.map((tc) => ({
|
|
8168
|
+
id: tc.id,
|
|
8169
|
+
name: tc.function.name,
|
|
8170
|
+
arguments: JSON.parse(tc.function.arguments),
|
|
8171
|
+
})),
|
|
8172
|
+
};
|
|
8163
8173
|
return {
|
|
8164
|
-
response:
|
|
8165
|
-
tool_calls: toolCalls.map((tc) => ({
|
|
8166
|
-
id: tc.id,
|
|
8167
|
-
name: tc.function.name,
|
|
8168
|
-
arguments: JSON.parse(tc.function.arguments),
|
|
8169
|
-
})),
|
|
8170
|
-
},
|
|
8174
|
+
response: toolCallResponse,
|
|
8171
8175
|
usage: {
|
|
8172
8176
|
prompt_tokens: promptTokens,
|
|
8173
8177
|
completion_tokens: completionTokens,
|
|
@@ -8717,14 +8721,15 @@ const makeDeepseekCall = async (content, responseFormat = 'json', options = {})
|
|
|
8717
8721
|
getLLMCostTracker().trackUsage('deepseek', completion.model, completion.usage.prompt_tokens, completion.usage.completion_tokens);
|
|
8718
8722
|
// Handle tool calls similarly to OpenAI
|
|
8719
8723
|
if (completion.tool_calls && completion.tool_calls.length > 0) {
|
|
8724
|
+
const toolCallResponse = {
|
|
8725
|
+
tool_calls: completion.tool_calls.map((tc) => ({
|
|
8726
|
+
id: tc.id,
|
|
8727
|
+
name: tc.function.name,
|
|
8728
|
+
arguments: JSON.parse(tc.function.arguments),
|
|
8729
|
+
})),
|
|
8730
|
+
};
|
|
8720
8731
|
return {
|
|
8721
|
-
response:
|
|
8722
|
-
tool_calls: completion.tool_calls.map((tc) => ({
|
|
8723
|
-
id: tc.id,
|
|
8724
|
-
name: tc.function.name,
|
|
8725
|
-
arguments: JSON.parse(tc.function.arguments),
|
|
8726
|
-
})),
|
|
8727
|
-
},
|
|
8732
|
+
response: toolCallResponse,
|
|
8728
8733
|
usage: {
|
|
8729
8734
|
prompt_tokens: completion.usage.prompt_tokens,
|
|
8730
8735
|
completion_tokens: completion.usage.completion_tokens,
|
|
@@ -8900,7 +8905,7 @@ const validateEnvironmentVars = () => {
|
|
|
8900
8905
|
return {
|
|
8901
8906
|
isValid: true,
|
|
8902
8907
|
source: 'lambda',
|
|
8903
|
-
vars: {} // No need for explicit credentials in Lambda
|
|
8908
|
+
vars: { accessKeyId: '', secretAccessKey: '', region: '' } // No need for explicit credentials in Lambda
|
|
8904
8909
|
};
|
|
8905
8910
|
}
|
|
8906
8911
|
else if (areVarsComplete(secrets.aws.myAccessKeyId, secrets.aws.mySecretAccessKey, secrets.aws.myRegion)) {
|
|
@@ -9709,7 +9714,7 @@ async function downloadFile(s3Client, bucketName, s3Key, localFilePath) {
|
|
|
9709
9714
|
async function unzipFile(zipPath, destPath) {
|
|
9710
9715
|
const zip = new AdmZip(zipPath);
|
|
9711
9716
|
try {
|
|
9712
|
-
|
|
9717
|
+
zip.extractAllToAsync(destPath, true);
|
|
9713
9718
|
const stats = await getDirectoryStats(destPath);
|
|
9714
9719
|
return stats;
|
|
9715
9720
|
}
|
|
@@ -22670,11 +22675,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
|
|
|
22670
22675
|
async function loadApolloModules() {
|
|
22671
22676
|
if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
|
|
22672
22677
|
// Server-side (or Lambda): load the CommonJS‑based implementation.
|
|
22673
|
-
return (await Promise.resolve().then(function () { return require('./apollo-client.server-
|
|
22678
|
+
return (await Promise.resolve().then(function () { return require('./apollo-client.server-DqSN1Fiy.js'); }));
|
|
22674
22679
|
}
|
|
22675
22680
|
else {
|
|
22676
22681
|
// Client-side: load the ESM‑based implementation.
|
|
22677
|
-
return (await Promise.resolve().then(function () { return require('./apollo-client.client-
|
|
22682
|
+
return (await Promise.resolve().then(function () { return require('./apollo-client.client-DcvDB-WD.js'); }));
|
|
22678
22683
|
}
|
|
22679
22684
|
}
|
|
22680
22685
|
/**
|
|
@@ -81385,4 +81390,4 @@ exports.withCorrelationId = withCorrelationId;
|
|
|
81385
81390
|
exports.withMetrics = withMetrics;
|
|
81386
81391
|
exports.withRateLimit = withRateLimit;
|
|
81387
81392
|
exports.withRetry = withRetry;
|
|
81388
|
-
//# sourceMappingURL=index-
|
|
81393
|
+
//# sourceMappingURL=index-BD1cU0P8.js.map
|