-
Notifications
You must be signed in to change notification settings - Fork 2k
Feat/stagehand #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat/stagehand #589
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@fahadali503 is attempting to deploy a commit to the Sim Studio Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Extends Stagehand functionality with environment and model selection capabilities, focusing on improved configuration and validation.
- Added required
model
andenv
parameters inapps/sim/tools/stagehand/types.ts
to support flexible model selection and environment configuration - Enhanced validation in
apps/sim/app/api/tools/stagehand/extract/route.ts
to conditionally check environment-specific variables (BROWSERBASE_API_KEY
,BROWSERBASE_PROJECT_ID
) - Updated
StagehandBlock
inapps/sim/blocks/blocks/stagehand.ts
to include dropdown UI for environment selection (browserbase
/local
) and model options - Added new realtime service configuration in
docker-compose.prod.yml
with health checks and service dependencies
7 files reviewed, 5 comments
Edit PR Review Bot Settings | Greptile
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, | ||
{ id: 'gemini-1.5-flash', label: 'gemini-1.5-flash' }, | ||
{ id: 'gemini-1.5-pro', label: 'gemini-1.5-pro' }, | ||
{ id: 'gemini-1.5-flash-8b', label: 'gemini-1.5-flash-8b' }, | ||
{ id: 'gemini-2.0-flash-lite', label: 'gemini-2.0-flash-lite' }, | ||
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Duplicate entry 'gemini-2.0-flash' in model options. Remove one instance to prevent confusion.
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, | |
{ id: 'gemini-1.5-flash', label: 'gemini-1.5-flash' }, | |
{ id: 'gemini-1.5-pro', label: 'gemini-1.5-pro' }, | |
{ id: 'gemini-1.5-flash-8b', label: 'gemini-1.5-flash-8b' }, | |
{ id: 'gemini-2.0-flash-lite', label: 'gemini-2.0-flash-lite' }, | |
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, | |
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, | |
{ id: 'gemini-1.5-flash', label: 'gemini-1.5-flash' }, | |
{ id: 'gemini-1.5-pro', label: 'gemini-1.5-pro' }, | |
{ id: 'gemini-1.5-flash-8b', label: 'gemini-1.5-flash-8b' }, | |
{ id: 'gemini-2.0-flash-lite', label: 'gemini-2.0-flash-lite' }, |
model: { type: 'string', required: true }, | ||
env: { type: 'string', required: true, }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Extra comma after required: true in env field definition. Remove for consistency.
model: { type: 'string', required: true }, | |
env: { type: 'string', required: true, }, | |
model: { type: 'string', required: true }, | |
env: { type: 'string', required: true }, |
{ | ||
id: "model", | ||
title: 'Model', | ||
type: "combobox", | ||
placeholder: 'Select the model to use for extraction', | ||
layout: 'full', | ||
options: [ | ||
{ id: 'gpt-4o', label: 'gpt-4o' }, | ||
{ id: 'gpt-4o-mini', label: 'gpt-4o-mini' }, | ||
{ id: 'gpt-4o-2024-08-06', label: 'gpt-4o-2024-08-06' }, | ||
{ id: 'gpt-4.5-preview', label: 'gpt-4.5-preview' }, | ||
{ id: 'claude-3-5-sonnet-latest', label: 'claude-3-5-sonnet-latest' }, | ||
{ id: 'claude-3-5-sonnet-20241022', label: 'claude-3-5-sonnet-20241022' }, | ||
{ id: 'claude-3-5-sonnet-20240620', label: 'claude-3-5-sonnet-20240620' }, | ||
{ id: 'claude-3-7-sonnet-latest', label: 'claude-3-7-sonnet-latest' }, | ||
{ id: 'claude-3-7-sonnet-20250219', label: 'claude-3-7-sonnet-20250219' }, | ||
{ id: 'o1-mini', label: 'o1-mini' }, | ||
{ id: 'o1-preview', label: 'o1-preview' }, | ||
{ id: 'o3-mini', label: 'o3-mini' }, | ||
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, | ||
{ id: 'gemini-1.5-flash', label: 'gemini-1.5-flash' }, | ||
{ id: 'gemini-1.5-pro', label: 'gemini-1.5-pro' }, | ||
{ id: 'gemini-1.5-flash-8b', label: 'gemini-1.5-flash-8b' }, | ||
{ id: 'gemini-2.0-flash-lite', label: 'gemini-2.0-flash-lite' }, | ||
{ id: 'gemini-2.0-flash', label: 'gemini-2.0-flash' }, | ||
{ id: 'gemini-2.5-pro-preview-03-25', label: 'gemini-2.5-pro-preview-03-25' }, | ||
{ id: 'cerebras-llama-3.3-70b', label: 'cerebras-llama-3.3-70b' }, | ||
{ id: 'cerebras-llama-3.1-8b', label: 'cerebras-llama-3.1-8b' }, | ||
{ id: 'groq-llama-3.3-70b-versatile', label: 'groq-llama-3.3-70b-versatile' }, | ||
{ id: 'groq-llama-3.3-70b-specdec', label: 'groq-llama-3.3-70b-specdec' } | ||
] | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider moving model options to a separate config file to improve maintainability
env: env === 'browserbase' ? 'BROWSERBASE' : 'LOCAL', | ||
apiKey: BROWSERBASE_API_KEY, | ||
projectId: BROWSERBASE_PROJECT_ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: apiKey and projectId are always passed to Stagehand even when env is 'local'. Only pass these for browserbase environment
env: env === 'browserbase' ? 'BROWSERBASE' : 'LOCAL', | |
apiKey: BROWSERBASE_API_KEY, | |
projectId: BROWSERBASE_PROJECT_ID, | |
env: env === 'browserbase' ? 'BROWSERBASE' : 'LOCAL', | |
...(env === 'browserbase' && { | |
apiKey: BROWSERBASE_API_KEY, | |
projectId: BROWSERBASE_PROJECT_ID, | |
}), |
model: z.enum([ | ||
"gpt-4o", | ||
"gpt-4o-mini", | ||
"gpt-4o-2024-08-06", | ||
"gpt-4.5-preview", | ||
"claude-3-5-sonnet-latest", | ||
"claude-3-5-sonnet-20241022", | ||
"claude-3-5-sonnet-20240620", | ||
"claude-3-7-sonnet-latest", | ||
"claude-3-7-sonnet-20250219", | ||
"o1-mini", | ||
"o1-preview", | ||
"o3-mini", | ||
"gemini-2.0-flash", | ||
"gemini-1.5-flash", | ||
"gemini-1.5-pro", | ||
"gemini-1.5-flash-8b", | ||
"gemini-2.0-flash-lite", | ||
"gemini-2.0-flash", | ||
"gemini-2.5-pro-preview-03-25", | ||
"cerebras-llama-3.3-70b", | ||
"cerebras-llama-3.1-8b", | ||
"groq-llama-3.3-70b-versatile", | ||
"groq-llama-3.3-70b-specdec" | ||
]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Extract model list to separate config file to improve maintainability
This pull request introduces several enhancements and fixes across multiple files, focusing on extending functionality for model and environment selection, improving validation, and standardizing configurations. Below are the most important changes grouped by theme:
Feature Enhancements
model
andenv
parameters in theStagehand
extraction tool. This includes extending therequestSchema
inapps/sim/app/api/tools/stagehand/extract/route.ts
to validate these new fields and updating thePOST
function to handle them appropriately. [1] [2] [3]StagehandBlock
configuration inapps/sim/blocks/blocks/stagehand.ts
to include dropdown options for selecting the environment (browserbase
orlocal
) and the model to use for extraction. [1] [2]StagehandExtractParams
and related types inapps/sim/tools/stagehand/types.ts
to includemodel
andenv
fields, ensuring type safety for the new parameters.Validation and Error Handling
env
parameter.BROWSERBASE_API_KEY
,BROWSERBASE_PROJECT_ID
) are only checked when theenv
is set tobrowserbase
.Configuration and Standardization
docker-compose.prod.yml
by replacing single quotes with double quotes for consistency. [1] [2] [3] [4] [5]These changes collectively improve the flexibility, usability, and maintainability of the codebase while introducing new capabilities for users to configure and execute data extraction tasks.