错误: ChatGoogle 无法修复 Gemini 返回的操作列表为 JSON 字符串,因此该步骤无法通过验证并会重试
import asyncio import json from importlib.metadata import version from types import SimpleNamespace from google.genai import types from browser_use.agent.views import AgentOutput from browser_use.LLM.exceptions import ModelProviderError from browser_use.LLM.google.chat import ChatGoogle from browser_use.LLM.messages import UserMessage from browser_use.tools.service import Tools ACTION = [{"done": {"text": "## Status\nShipment A1 delivered.\n| a | b |", "success": True, "files_to_display": []}}] PAYLOAD = { "thinking": "done", "evaluation_previous_goal": "ok", "memory": "m", "next_goal": "finish", "action": json.dumps(ACTION), # the model double-encodes the list }
async def main() -> None: print("browser-use", version("browser-use"), "google-genai", version("google-genai")) output_type = AgentOutput.type_with_custom_actions(Tools().registry.create_action_model())
response = types.GenerateContentResponse( candidates=[ Candidate( content=types.Content(role="model", …
内容来源: browser-use/browser-use