mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
openai[patch]: add comment (#23595)
Forgot to push this to https://github.com/langchain-ai/langchain/pull/23551
This commit is contained in:
parent
9f0f3c7e29
commit
5536420bee
@ -219,6 +219,11 @@ 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"}
|
||||
message_dict = {k: v for k, v in message_dict.items() if k in supported_props}
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user