Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Enable max tokens for openai and top_p
Magnus Müller6285bfeca0f9
diff --git a/browser_use/llm/openai/chat.py b/browser_use/llm/openai/chat.pyindex 96ce849fa..48be7993e 100644--- a/browser_use/llm/openai/chat.py+++ b/browser_use/llm/openai/chat.py@@ -50,6 +50,8 @@ class ChatOpenAI(BaseChatModel):default_query: Mapping[str, object] | None = Nonehttp_client: httpx.AsyncClient | None = None_strict_response_validation: bool = False+ max_completion_tokens: int | None = None+ top_p: float | None = None# Static@property@@ -150,6 +152,12 @@ class ChatOpenAI(BaseChatModel):if self.temperature is not None:model_params['temperature'] = self.temperature+ if self.max_completion_tokens is not None:+ model_params['max_completion_tokens'] = self.max_completion_tokens++ if self.top_p is not None:+ model_params['top_p'] = self.top_p+if output_format is None:# Return string responseresponse = await self.get_client().chat.completions.create(