Skip to content

The agent engineering platform.

fix(core): add "computer" to _WellKnownOpenAITools (#36261)

Weiguang Lie6c1b29e8060
diff --git a/libs/core/langchain_core/utils/function_calling.py b/libs/core/langchain_core/utils/function_calling.py
index ea3d0f2623..0fefd98b0e 100644
--- a/libs/core/langchain_core/utils/function_calling.py
+++ b/libs/core/langchain_core/utils/function_calling.py
@@ -500,6 +500,7 @@ def convert_to_openai_function(
_WellKnownOpenAITools = (
"function",
"file_search",
+ "computer",
"computer_use_preview",
"code_interpreter",
"mcp",
diff --git a/libs/core/tests/unit_tests/utils/test_function_calling.py b/libs/core/tests/unit_tests/utils/test_function_calling.py
index e56ae47e22..f3aa224029 100644
--- a/libs/core/tests/unit_tests/utils/test_function_calling.py
+++ b/libs/core/tests/unit_tests/utils/test_function_calling.py
@@ -32,6 +32,7 @@ from langchain_core.utils.function_calling import (
_convert_typed_dict_to_openai_function,
convert_to_json_schema,
convert_to_openai_function,
+ convert_to_openai_tool,
tool_example_to_messages,
)
@@ -1242,3 +1243,15 @@ def test_convert_to_openai_function_json_schema_missing_title_includes_schema()
}
with pytest.raises(ValueError, match="my_field"):
convert_to_openai_function(schema_without_title)
+
+
+def test_convert_to_openai_tool_computer_passthrough() -> None:
+ """Test that the 'computer' tool type is passed through unchanged."""
+ computer_tool = {
+ "type": "computer",
+ "display_width": 1024,
+ "display_height": 768,
+ "environment": "browser",
+ }
+ result = convert_to_openai_tool(computer_tool)
+ assert result == computer_tool