From 3f2f30e6053cfb529b9cb72080b41686a57e8800 Mon Sep 17 00:00:00 2001 From: nai-degen Date: Sat, 27 Jan 2024 13:35:46 -0600 Subject: [PATCH] updates gpt4-v tokenizer for previous Risu change --- src/shared/tokenization/openai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/tokenization/openai.ts b/src/shared/tokenization/openai.ts index a048e12..23be4f5 100644 --- a/src/shared/tokenization/openai.ts +++ b/src/shared/tokenization/openai.ts @@ -54,7 +54,7 @@ export async function getTokenCount( for (const item of value) { if (item.type === "text") { textContent += item.text; - } else if (item.type === "image_url") { + } else if (["image", "image_url"].includes(item.type)) { const { url, detail } = item.image_url; const cost = await getGpt4VisionTokenCost(url, detail); numTokens += cost ?? 0;