Skip to content

Conversation

fahadali503
Copy link

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

  • Added support for specifying model and env parameters in the Stagehand extraction tool. This includes extending the requestSchema in apps/sim/app/api/tools/stagehand/extract/route.ts to validate these new fields and updating the POST function to handle them appropriately. [1] [2] [3]
  • Updated the StagehandBlock configuration in apps/sim/blocks/blocks/stagehand.ts to include dropdown options for selecting the environment (browserbase or local) and the model to use for extraction. [1] [2]
  • Extended StagehandExtractParams and related types in apps/sim/tools/stagehand/types.ts to include model and env fields, ensuring type safety for the new parameters.

Validation and Error Handling

  • Improved validation for API keys by generalizing the error message to handle non-OpenAI keys and ensuring compatibility with the new env parameter.
  • Enhanced environment-specific logic to ensure required variables (BROWSERBASE_API_KEY, BROWSERBASE_PROJECT_ID) are only checked when the env is set to browserbase.

Configuration and Standardization

  • Standardized the formatting of strings in 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.

Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2025 7:02pm

Copy link

vercel bot commented Jun 30, 2025

@fahadali503 is attempting to deploy a commit to the Sim Studio Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 and env parameters in apps/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 in apps/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

Comment on lines +66 to +71
{ 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' },
Copy link
Contributor

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.

Suggested change
{ 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' },

Comment on lines +108 to +109
model: { type: 'string', required: true },
env: { type: 'string', required: true, },
Copy link
Contributor

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.

Suggested change
model: { type: 'string', required: true },
env: { type: 'string', required: true, },
model: { type: 'string', required: true },
env: { type: 'string', required: true },

Comment on lines +47 to +78
{
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' }
]
},
Copy link
Contributor

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

Comment on lines +111 to 113
env: env === 'browserbase' ? 'BROWSERBASE' : 'LOCAL',
apiKey: BROWSERBASE_API_KEY,
projectId: BROWSERBASE_PROJECT_ID,
Copy link
Contributor

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

Suggested change
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,
}),

Comment on lines +21 to +45
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"
]),
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant