From 2ffd2b720a03a45394db46749cf1186ac3c9a60a Mon Sep 17 00:00:00 2001 From: bracesproul Date: Thu, 13 Jun 2024 11:28:29 -0700 Subject: [PATCH] openai[patch]: Fix tool content list --- libs/langchain-openai/src/chat_models.ts | 2 ++ .../src/tests/chat_models.standard.int.test.ts | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index 243518c41c2d..4c7bb9aedb45 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -233,6 +233,7 @@ function convertMessagesToOpenAIParams(messages: BaseMessage[]) { completionParam.tool_calls = message.tool_calls.map( convertLangChainToolCallToOpenAI ); + completionParam.content = null; } else { if (message.additional_kwargs.tool_calls != null) { completionParam.tool_calls = message.additional_kwargs.tool_calls; @@ -948,6 +949,7 @@ export class ChatOpenAI< const requestOptions = this._getClientOptions(options); return this.caller.call(async () => { try { + console.log(request.messages) const res = await this.client.chat.completions.create( request, requestOptions diff --git a/libs/langchain-openai/src/tests/chat_models.standard.int.test.ts b/libs/langchain-openai/src/tests/chat_models.standard.int.test.ts index 9c0c4e0d90d2..6eb91f093c4c 100644 --- a/libs/langchain-openai/src/tests/chat_models.standard.int.test.ts +++ b/libs/langchain-openai/src/tests/chat_models.standard.int.test.ts @@ -24,12 +24,6 @@ class ChatOpenAIStandardIntegrationTests extends ChatModelIntegrationTests< }); } - async testToolMessageHistoriesListContent() { - console.warn( - "ChatOpenAI testToolMessageHistoriesListContent test known failure. Skipping..." - ); - } - async testUsageMetadataStreaming() { // ChatOpenAI does not support streaming tokens by // default, so we must pass in a call option to