-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a40c5a
commit 078ebdf
Showing
14 changed files
with
706 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# OpenAI API Key for GPT-4 model | ||
OPENAI_API_KEY=your-openai-api-key-here | ||
|
||
# Anthropic API Key for Claude model | ||
ANTHROPIC_API_KEY=your-anthropic-api-key-here | ||
|
||
# Optional: Model configurations | ||
GPT4_MODEL=gpt-4-turbo-preview # or gpt-4 | ||
CLAUDE_MODEL=claude-3-opus-20240229 | ||
|
||
# Optional: Execution settings | ||
MAX_WORKERS=4 | ||
TIMEOUT_SECONDS=30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Example usage of different models in the DOM benchmark.""" | ||
|
||
import os | ||
from dotenv import load_dotenv | ||
from models import GPT4Model, ClaudeModel | ||
from utils import TaskExecutor | ||
|
||
# Load environment variables | ||
load_dotenv() | ||
|
||
def run_example_task(model, task): | ||
"""Run a single task with the given model and print results.""" | ||
executor = TaskExecutor() | ||
print(f"\nRunning task with {model.__class__.__name__}:") | ||
print(f"Task: {task['task']}") | ||
|
||
result = model.run_task(task, executor) | ||
|
||
print(f"Success: {result.success}") | ||
if result.error: | ||
print(f"Error: {result.error}") | ||
print(f"Time taken: {result.time_taken:.2f}s") | ||
return result | ||
|
||
def main(): | ||
# Initialize models | ||
gpt4_model = GPT4Model(api_key=os.getenv("OPENAI_API_KEY")) | ||
claude_model = ClaudeModel(api_key=os.getenv("ANTHROPIC_API_KEY")) | ||
|
||
# Example task | ||
task = { | ||
"task": "Click the 'Sign In' button", | ||
"target_element": { | ||
"type": "css", | ||
"value": "#signin-button" | ||
}, | ||
"interaction": "click" | ||
} | ||
|
||
# Run with both models | ||
gpt4_result = run_example_task(gpt4_model, task) | ||
claude_result = run_example_task(claude_model, task) | ||
|
||
# Compare results | ||
print("\nComparison:") | ||
print(f"GPT-4 success: {gpt4_result.success}") | ||
print(f"Claude success: {claude_result.success}") | ||
print(f"GPT-4 time: {gpt4_result.time_taken:.2f}s") | ||
print(f"Claude time: {claude_result.time_taken:.2f}s") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .base import BaseModel, WebInteraction, TaskResult | ||
from .gpt4 import GPT4Model | ||
from .claude import ClaudeModel | ||
|
||
__all__ = ['BaseModel', 'WebInteraction', 'TaskResult', 'GPT4Model', 'ClaudeModel'] |
Oops, something went wrong.