We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d52b9f commit 8e14c96Copy full SHA for 8e14c96
packages/core/src/generation.ts
@@ -72,6 +72,9 @@ export async function trimTokens(
72
maxTokens: number,
73
runtime: IAgentRuntime
74
) {
75
+ if (!context) return "";
76
+ if (maxTokens <= 0) throw new Error("maxTokens must be positive");
77
+
78
const tokenizerModel = runtime.getSetting("TOKENIZER_MODEL");
79
const tokenizerType = runtime.getSetting("TOKENIZER_TYPE");
80
0 commit comments