Skip to content

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

Handle Mistral timeout defaults and fix pixtral mapping

MagellaXd58ae80b5019
diff --git a/browser_use/llm/mistral/chat.py b/browser_use/llm/mistral/chat.py
index c6e85e331..ddd475647 100644
--- a/browser_use/llm/mistral/chat.py
+++ b/browser_use/llm/mistral/chat.py
@@ -75,7 +75,10 @@ class ChatMistral(BaseChatModel):
if not hasattr(self, '_cached_client'):
transport = httpx.AsyncHTTPTransport(retries=self.max_retries)
- self._cached_client = httpx.AsyncClient(timeout=self.timeout, transport=transport)
+ client_args: dict[str, Any] = {'transport': transport}
+ if self.timeout is not None:
+ client_args['timeout'] = self.timeout
+ self._cached_client = httpx.AsyncClient(**client_args)
return self._cached_client
def _serialize_messages(self, messages: list[BaseMessage]) -> list[dict[str, Any]]:
diff --git a/browser_use/llm/models.py b/browser_use/llm/models.py
index 313548931..023ffb683 100644
--- a/browser_use/llm/models.py
+++ b/browser_use/llm/models.py
@@ -187,7 +187,8 @@ def get_llm_by_name(model_name: str):
'codestral': 'codestral-latest',
'pixtral-large': 'pixtral-large-latest',
}
- resolved_model = mistral_map.get(model_part, model.replace('_', '-'))
+ normalized_model_part = model_part.replace('_', '-')
+ resolved_model = mistral_map.get(normalized_model_part, model.replace('_', '-'))
return ChatMistral(model=resolved_model, api_key=api_key, base_url=base_url)
# OCI Models