Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix openai import

Nick Sweetingd9ed2324c6d1
diff --git a/browser_use/llm/openai/serializer.py b/browser_use/llm/openai/serializer.py
index 2bcdddd1d..2d0f96ff3 100644
--- a/browser_use/llm/openai/serializer.py
+++ b/browser_use/llm/openai/serializer.py
@@ -5,13 +5,13 @@ from openai.types.chat import (
ChatCompletionContentPartImageParam,
ChatCompletionContentPartRefusalParam,
ChatCompletionContentPartTextParam,
- ChatCompletionMessageFunctionToolCallParam,
+ ChatCompletionMessageToolCallParam,
ChatCompletionMessageParam,
ChatCompletionSystemMessageParam,
ChatCompletionUserMessageParam,
)
from openai.types.chat.chat_completion_content_part_image_param import ImageURL
-from openai.types.chat.chat_completion_message_function_tool_call_param import Function
+from openai.types.chat.chat_completion_message_tool_call_param import Function
from browser_use.llm.messages import (
AssistantMessage,
@@ -92,8 +92,8 @@ class OpenAIMessageSerializer:
return serialized_parts
@staticmethod
- def _serialize_tool_call(tool_call: ToolCall) -> ChatCompletionMessageFunctionToolCallParam:
- return ChatCompletionMessageFunctionToolCallParam(
+ def _serialize_tool_call(tool_call: ToolCall) -> ChatCompletionMessageToolCallParam:
+ return ChatCompletionMessageToolCallParam(
id=tool_call.id,
function=Function(name=tool_call.function.name, arguments=tool_call.function.arguments),
type='function',