Skip to content

How to implement with browser use? #6

Open
@powderblock

Description

I'd like to implement emmetify with browser_use

Here is my code:

from langchain_openai import ChatOpenAI
from browser_use import Agent
from dotenv import load_dotenv
load_dotenv()

import asyncio

from browser_use import Agent, SystemPrompt

class MySystemPrompt(SystemPrompt):
    def important_rules(self) -> str:
        # Get existing rules from parent class
        existing_rules = super().important_rules()

        # Add your custom rules
        new_rules = """Go to google.com
search the current weather in San Francisco
give me the weather in a friendly message."""

        # Make sure to use this pattern otherwise the exiting rules will be lost
        return f'{existing_rules}\n{new_rules}'

from langchain_openai import ChatOpenAI

# Initialize the model
model = ChatOpenAI(model='gpt-4o')

async def main():
    # Create agent with custom system prompt
    agent = Agent(
        task="Complete the task in the system prompt.",
        llm=model,
        system_prompt_class=MySystemPrompt
    )
    result = await agent.run()
    print(result)

asyncio.run(main())

Any ideas how to implement emmetify with browser use?

Thank you in advance <3 :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions