Skip to content

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

fixed type errors

Gregor Žunič4e3adb35d48b
diff --git a/examples/models/langchain/chat.py b/examples/models/langchain/chat.py
index c4b7ad693..5313189e5 100644
--- a/examples/models/langchain/chat.py
+++ b/examples/models/langchain/chat.py
@@ -155,6 +155,13 @@ class ChatLangchain(BaseChatModel):
except AttributeError:
# Fall back to manual parsing if with_structured_output is not available
response = await self.chat.ainvoke(langchain_messages) # type: ignore
+
+ if not isinstance(response, 'LangChainAIMessage'):
+ raise ModelProviderError(
+ message=f'Response is not an AIMessage: {type(response)}',
+ model=self.name,
+ )
+
content = response.content if hasattr(response, 'content') else str(response)
try:
diff --git a/pyproject.toml b/pyproject.toml
index f44b394a0..e83b53df0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -64,7 +64,6 @@ examples = [
"stagehand-py>=0.3.6",
"browserbase>=0.4.0",
"langchain-openai>=0.3.26",
- "langchain-core>=0.3.0",
]
eval = [
"lmnr[all]>=0.6.11",
@@ -73,7 +72,7 @@ eval = [
"psutil>=7.0.0",
]
all = [
- "browser-use[cli,examples]",
+ "browser-use[cli,examples,aws]",
]
# will prefer to use local source code checked out in ../../browser-use (if present) instead of pypi browser-use package
@@ -187,4 +186,6 @@ dev-dependencies = [
"lmnr[all]>=0.6.13",
# "pytest-playwright-asyncio>=0.7.0", # not actually needed I think
"pytest-timeout>=2.4.0",
+ "boto3>=1.38.45",
+ "langchain-openai>=0.3.26"
]