Files
browser-use/eval/gpt-4o.py
Magnus Müller 76e4c2630d Update gpt-4o.py
2025-02-16 02:25:04 +01:00

30 lines
704 B
Python

import asyncio
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from browser_use import Agent, Controller
load_dotenv()
async def run_agent(task: str, max_steps: int = 38):
llm = ChatOpenAI(
model='gpt-4o',
temperature=0.0,
)
agent = Agent(
task=task,
llm=llm,
include_attributes=[
'title',
'type',
'name',
'role',
'tabindex',
'aria-label',
'placeholder',
'value',
'alt',
'aria-expanded',
'href',
],
)
result = await agent.run(max_steps=max_steps)
return result, result.history