Skip to content

Commit

Permalink
openai: fix allowed block types (#20636)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme authored and hinthornw committed Apr 26, 2024
1 parent ad75820 commit 336947c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/partners/openai/langchain_openai/chat_models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ def _format_message_content(content: Any) -> Any:
# Remove unexpected block types
formatted_content = []
for block in content:
if isinstance(block, dict) and "type" in block and block["type"] != "text":
if (
isinstance(block, dict)
and "type" in block
and block["type"] == "tool_use"
):
continue
else:
formatted_content.append(block)
Expand Down

0 comments on commit 336947c

Please sign in to comment.