Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Mar 19, 2024
1 parent 8c00918 commit 767f102
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/partners/openai/langchain_openai/chat_models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
return SystemMessage(content=_dict.get("content", ""), name=name, id=id_)
elif role == "function":
return FunctionMessage(
content=_dict.get("content", ""), name=cast(str, _dict.get("name"), id=id_)
content=_dict.get("content", ""), name=cast(str, _dict.get("name")), id=id_
)
elif role == "tool":
additional_kwargs = {}
Expand Down Expand Up @@ -166,6 +166,8 @@ def _convert_message_to_dict(message: BaseMessage) -> dict:
message_dict["role"] = "tool"
message_dict["tool_call_id"] = message.tool_call_id

warnings

Check failure on line 169 in libs/partners/openai/langchain_openai/chat_models/base.py

View workflow job for this annotation

GitHub Actions / cd libs/partners/openai / make lint #3.8

Ruff (F821)

langchain_openai/chat_models/base.py:169:9: F821 Undefined name `warnings`

Check failure on line 169 in libs/partners/openai/langchain_openai/chat_models/base.py

View workflow job for this annotation

GitHub Actions / cd libs/partners/openai / make lint #3.11

Ruff (F821)

langchain_openai/chat_models/base.py:169:9: F821 Undefined name `warnings`

# tool message doesn't have name: https://platform.openai.com/docs/api-reference/chat/create#chat-create-messages
del message_dict["name"]
else:
Expand Down

0 comments on commit 767f102

Please sign in to comment.