From a1520357c8053c89cf13caa269636688908d3bf1 Mon Sep 17 00:00:00 2001 From: ccurme Date: Thu, 27 Jun 2024 14:40:04 -0400 Subject: [PATCH] openai[patch]: revert addition of "name" to supported properties for tool messages (#23600) --- libs/partners/openai/langchain_openai/chat_models/base.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.py index 070e2e1bd36..b9c758024ab 100644 --- a/libs/partners/openai/langchain_openai/chat_models/base.py +++ b/libs/partners/openai/langchain_openai/chat_models/base.py @@ -219,12 +219,7 @@ def _convert_message_to_dict(message: BaseMessage) -> dict: message_dict["role"] = "tool" message_dict["tool_call_id"] = message.tool_call_id - # Note: "name" is not documented in OpenAI's API Reference - # https://platform.openai.com/docs/api-reference/chat/create - # but is referenced in cookbooks - # https://cookbook.openai.com/examples/how_to_call_functions_with_chat_models - # and is required for some proxys (e.g., Google Gemini). - supported_props = {"content", "role", "tool_call_id", "name"} + supported_props = {"content", "role", "tool_call_id"} message_dict = {k: v for k, v in message_dict.items() if k in supported_props} else: raise TypeError(f"Got unknown type {message}")