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
google chat add config option
mertunsall80cf4f872c45
diff --git a/browser_use/llm/google/chat.py b/browser_use/llm/google/chat.pyindex fb706988a..7592c86b3 100644--- a/browser_use/llm/google/chat.py+++ b/browser_use/llm/google/chat.py@@ -44,13 +44,36 @@ class ChatGoogle(BaseChatModel):"""A wrapper around Google's Gemini chat model using the genai client.- This class accepts all genai.Client parameters while adding model- and temperature parameters for the LLM interface.+ This class accepts all genai.Client parameters while adding model,+ temperature, and config_kwargs parameters for the LLM interface.++ Args:+ model: The Gemini model to use+ temperature: Temperature for response generation+ config: Additional configuration parameters to pass to generate_content+ (e.g., tools, safety_settings, etc.).+ api_key: Google API key+ vertexai: Whether to use Vertex AI+ credentials: Google credentials object+ project: Google Cloud project ID+ location: Google Cloud location+ http_options: HTTP options for the client++ Example:+ from google.genai import types++ llm = ChatGoogle(+ model='gemini-2.0-flash-exp',+ config={+ 'tools': [types.Tool(code_execution=types.ToolCodeExecution())]+ }+ )"""# Model configurationmodel: VerifiedGeminiModels | strtemperature: float | None = None+ config: types.GenerateContentConfigDict | None = None# Client initialization parametersapi_key: str | None = None@@ -142,8 +165,12 @@ class ChatGoogle(BaseChatModel):# Serialize messages to Google formatcontents, system_instruction = GoogleMessageSerializer.serialize_messages(messages)- # Return string response+ # Build config dictionary starting with user-provided configconfig: types.GenerateContentConfigDict = {}+ if self.config:+ config = self.config.copy()++ # Apply model-specific configuration (these can override config)if self.temperature is not None:config['temperature'] = self.temperature