openai: fix allowed block types (#20636)

This commit is contained in:
ccurme 2024-04-18 22:12:57 -04:00 committed by GitHub
parent 764871f97d
commit 6d530481c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)