Files
browser-use/examples/models/gemini.py
Magnus Müller 15f1a50895 Force thinking
2025-09-19 22:04:43 -07:00

31 lines
650 B
Python

import asyncio
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from dotenv import load_dotenv
from browser_use import Agent, ChatGoogle
load_dotenv()
api_key = os.getenv('GOOGLE_API_KEY')
if not api_key:
raise ValueError('GOOGLE_API_KEY is not set')
llm = ChatGoogle(model='gemini-2.0', api_key=api_key, thinking_budget=-1)
async def run_search():
agent = Agent(
task='Go to google.com/travel/flights and find the cheapest flight from New York to Paris on 2025-07-15',
llm=llm,
)
await agent.run(max_steps=25)
if __name__ == '__main__':
asyncio.run(run_search())