Skip to content

Commit

Permalink
openai[patch]: Fix tool content list (#5756)
Browse files Browse the repository at this point in the history
* openai[patch]: Fix tool content list

* same for func calls

* chore: lint files

* drop console log
  • Loading branch information
bracesproul authored Jun 13, 2024
1 parent 308e5b2 commit b1cef30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions libs/langchain-openai/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1cef30

Please sign in to comment.