llmist 4.0.0 → 5.0.0
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/{chunk-RHR2M6T6.js → chunk-3SZIQI45.js} +16 -7
- package/dist/chunk-3SZIQI45.js.map +1 -0
- package/dist/{chunk-Q6NQRMYD.js → chunk-UBPZUVIN.js} +2 -2
- package/dist/cli.cjs +327 -215
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +284 -181
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +15 -6
- 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 +2 -2
- package/dist/{mock-stream-BvNYtrlG.d.cts → mock-stream-CAY53Q6u.d.cts} +23 -2
- package/dist/{mock-stream-BvNYtrlG.d.ts → mock-stream-CAY53Q6u.d.ts} +23 -2
- package/dist/testing/index.cjs +15 -6
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-RHR2M6T6.js.map +0 -1
- /package/dist/{chunk-Q6NQRMYD.js.map → chunk-UBPZUVIN.js.map} +0 -0
|
@@ -5005,15 +5005,16 @@ var init_agent = __esm({
|
|
|
5005
5005
|
});
|
|
5006
5006
|
} else if (event.type === "llm_call_end") {
|
|
5007
5007
|
const info = event.event;
|
|
5008
|
+
const usage = info.usage ?? (info.outputTokens ? {
|
|
5009
|
+
inputTokens: info.inputTokens ?? 0,
|
|
5010
|
+
outputTokens: info.outputTokens,
|
|
5011
|
+
totalTokens: (info.inputTokens ?? 0) + info.outputTokens
|
|
5012
|
+
} : void 0);
|
|
5008
5013
|
void this.hooks?.observers?.onLLMCallComplete?.({
|
|
5009
5014
|
iteration: info.iteration,
|
|
5010
5015
|
options: { model: info.model, messages: [] },
|
|
5011
5016
|
finishReason: info.finishReason ?? null,
|
|
5012
|
-
usage
|
|
5013
|
-
inputTokens: info.inputTokens ?? 0,
|
|
5014
|
-
outputTokens: info.outputTokens,
|
|
5015
|
-
totalTokens: (info.inputTokens ?? 0) + info.outputTokens
|
|
5016
|
-
} : void 0,
|
|
5017
|
+
usage,
|
|
5017
5018
|
rawResponse: "",
|
|
5018
5019
|
finalMessage: "",
|
|
5019
5020
|
logger: this.logger,
|
|
@@ -6278,8 +6279,13 @@ ${endPrefix}`
|
|
|
6278
6279
|
event: {
|
|
6279
6280
|
iteration: context.iteration,
|
|
6280
6281
|
model: context.options.model,
|
|
6282
|
+
// Backward compat fields
|
|
6283
|
+
inputTokens: context.usage?.inputTokens,
|
|
6281
6284
|
outputTokens: context.usage?.outputTokens,
|
|
6282
|
-
finishReason: context.finishReason
|
|
6285
|
+
finishReason: context.finishReason ?? void 0,
|
|
6286
|
+
// Full usage object with cache details (for first-class display)
|
|
6287
|
+
usage: context.usage
|
|
6288
|
+
// Cost will be calculated by parent if it has model registry
|
|
6283
6289
|
}
|
|
6284
6290
|
});
|
|
6285
6291
|
if (existingOnLLMCallComplete) {
|
|
@@ -8133,6 +8139,9 @@ var init_gemini = __esm({
|
|
|
8133
8139
|
async countTokens(messages, descriptor, _spec) {
|
|
8134
8140
|
const client = this.client;
|
|
8135
8141
|
const contents = this.convertMessagesToContents(messages);
|
|
8142
|
+
if (!contents || contents.length === 0) {
|
|
8143
|
+
return 0;
|
|
8144
|
+
}
|
|
8136
8145
|
try {
|
|
8137
8146
|
const response = await client.models.countTokens({
|
|
8138
8147
|
model: descriptor.name,
|
|
@@ -11698,4 +11707,4 @@ export {
|
|
|
11698
11707
|
createEmptyStream,
|
|
11699
11708
|
createErrorStream
|
|
11700
11709
|
};
|
|
11701
|
-
//# sourceMappingURL=chunk-
|
|
11710
|
+
//# sourceMappingURL=chunk-3SZIQI45.js.map
|