From 56b0d040da2b3c97fad592efa045ecee3b90e47f Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Mon, 26 Aug 2024 15:44:46 -0700 Subject: [PATCH] openai[patch]: Properly dedupe system fingerprint (#6638) --- libs/langchain-openai/src/chat_models.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index 0a93c9d1b138..cedb15777527 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -1255,7 +1255,7 @@ export class ChatOpenAI< } // eslint-disable-next-line @typescript-eslint/no-explicit-any const generationInfo: Record = { ...newTokenIndices }; - if (choice.finish_reason !== undefined) { + if (choice.finish_reason != null) { generationInfo.finish_reason = choice.finish_reason; // Only include system fingerprint in the last chunk for now // to avoid concatenation issues