diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index 243518c41c2d..8282ab235906 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -228,11 +228,13 @@ function convertMessagesToOpenAIParams(messages: BaseMessage[]) { } if (message.additional_kwargs.function_call != null) { completionParam.function_call = message.additional_kwargs.function_call; + completionParam.content = null; } if (isAIMessage(message) && !!message.tool_calls?.length) { 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; 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