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
added Generic support for python 3.11
Gregor Žunič7538a68df832
diff --git a/browser_use/llm/views.py b/browser_use/llm/views.pyindex c093aea91..136d1e1b4 100644--- a/browser_use/llm/views.py+++ b/browser_use/llm/views.py@@ -1,8 +1,8 @@-from typing import TypeVar+from typing import Generic, TypeVar, Unionfrom pydantic import BaseModel-T = TypeVar('T', bound=BaseModel)+T = TypeVar('T', bound=Union[BaseModel, str])class ChatInvokeUsage(BaseModel):@@ -23,7 +23,7 @@ class ChatInvokeUsage(BaseModel):"""The number of tokens in the image. Google only (prompt tokens is the text tokens + image tokens in that case)"""-class ChatInvokeCompletion[T: BaseModel | str](BaseModel):+class ChatInvokeCompletion(BaseModel, Generic[T]):"""Response from a chat model invocation."""