From d8967147be3c80cefb50099a2fb446da17f034de Mon Sep 17 00:00:00 2001 From: Crazy Urus Date: Mon, 27 May 2024 13:02:05 +0800 Subject: [PATCH] fix: moonshot did not return usage cause error --- libs/langchain-community/src/chat_models/moonshot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-community/src/chat_models/moonshot.ts b/libs/langchain-community/src/chat_models/moonshot.ts index 1ad88ae2d90d..1fb032f2c4ab 100644 --- a/libs/langchain-community/src/chat_models/moonshot.ts +++ b/libs/langchain-community/src/chat_models/moonshot.ts @@ -355,7 +355,7 @@ export class ChatMoonshot extends BaseChatModel implements ChatMoonshotParams { prompt_tokens = 0, completion_tokens = 0, total_tokens = 0, - } = data.usage; + } = data.usage ?? {}; const { text } = data.output;