Skip to content

Commit ae60d1e

Browse files
committed
fix: resolve TODO in to make model more dynamic and generic
1 parent 4c658d7 commit ae60d1e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/client-discord/src/actions/chat_with_attachments.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { composeContext } from "@elizaos/core";
22
import { generateText, trimTokens } from "@elizaos/core";
3+
import type { TiktokenModel } from "js-tiktoken";
34
import { models } from "@elizaos/core";
45
import { parseJSONObjectFromText } from "@elizaos/core";
56
import {
@@ -194,10 +195,12 @@ const summarizeAction = {
194195
const context = composeContext({
195196
state,
196197
// make sure it fits, we can pad the tokens a bit
198+
// Get the model's tokenizer based on the current model being used
197199
template: trimTokens(
198200
summarizationTemplate,
199201
chunkSize + 500,
200-
"gpt-4o-mini" // TODO: make this dynamic and generic
202+
(model.model[ModelClass.SMALL] ||
203+
"gpt-4o-mini") as TiktokenModel // Use the same model as generation; Fallback if no SMALL model configured
201204
),
202205
});
203206

0 commit comments

Comments
 (0)