@browserbasehq/stagehand
Advanced tools
Comparing version 1.12.0-alpha-1032d7d7d9c1ef8f30183c9019ea8324f1bdd5c6 to 1.12.0-alpha-16837ece839e192fbf7b68bec128dd02f22c2613
@@ -21,3 +21,3 @@ import { z, ZodType } from 'zod'; | ||
declare const AvailableModelSchema: z.ZodEnum<["gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "o1-mini", "o1-preview"]>; | ||
declare const AvailableModelSchema: z.ZodEnum<["gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "o1-mini", "o1-preview", "o3-mini"]>; | ||
type AvailableModel = z.infer<typeof AvailableModelSchema>; | ||
@@ -60,3 +60,2 @@ type ModelProvider = "openai" | "anthropic"; | ||
} | ||
declare const modelsWithVision: AvailableModel[]; | ||
declare const AnnotatedScreenshotText = "This is a screenshot of the current page state with the elements annotated on it. Each element id is annotated with a number to the top left of it. Duplicate annotations at the same location are under each other vertically."; | ||
@@ -210,2 +209,4 @@ interface ChatCompletionOptions { | ||
onlyVisible?: boolean; | ||
/** @deprecated `useAccessibilityTree` is now deprecated. Use `onlyVisible` instead. */ | ||
useAccessibilityTree?: boolean; | ||
} | ||
@@ -310,2 +311,2 @@ interface ObserveResult { | ||
export { type ActOptions, type ActResult, AnnotatedScreenshotText, type AnthropicJsonSchemaObject, type AvailableModel, AvailableModelSchema, type Browser, type BrowserContext, type BrowserResult, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ConstructorParams, type CreateChatCompletionOptions, type ExtractOptions, type ExtractResult, type GotoOptions, type InitFromPageOptions, type InitFromPageResult, type InitOptions, type InitResult, LLMClient, type LLMResponse, type LogLine, type ModelProvider, type ObserveOptions, type ObserveResult, type Page, PlaywrightCommandException, PlaywrightCommandMethodNotSupportedException, Stagehand, defaultExtractSchema, modelsWithVision }; | ||
export { type ActOptions, type ActResult, AnnotatedScreenshotText, type AnthropicJsonSchemaObject, type AvailableModel, AvailableModelSchema, type Browser, type BrowserContext, type BrowserResult, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ConstructorParams, type CreateChatCompletionOptions, type ExtractOptions, type ExtractResult, type GotoOptions, type InitFromPageOptions, type InitFromPageResult, type InitOptions, type InitResult, LLMClient, type LLMResponse, type LogLine, type ModelProvider, type ObserveOptions, type ObserveResult, type Page, PlaywrightCommandException, PlaywrightCommandMethodNotSupportedException, Stagehand, defaultExtractSchema }; |
@@ -21,3 +21,2 @@ import { ZodType } from "zod"; | ||
} | ||
export declare const modelsWithVision: AvailableModel[]; | ||
export declare const AnnotatedScreenshotText = "This is a screenshot of the current page state with the elements annotated on it. Each element id is annotated with a number to the top left of it. Duplicate annotations at the same location are under each other vertically."; | ||
@@ -24,0 +23,0 @@ export interface ChatCompletionOptions { |
import type { ClientOptions as AnthropicClientOptions } from "@anthropic-ai/sdk"; | ||
import type { ClientOptions as OpenAIClientOptions } from "openai"; | ||
import { z } from "zod"; | ||
export declare const AvailableModelSchema: z.ZodEnum<["gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "o1-mini", "o1-preview"]>; | ||
export declare const AvailableModelSchema: z.ZodEnum<["gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "o1-mini", "o1-preview", "o3-mini"]>; | ||
export type AvailableModel = z.infer<typeof AvailableModelSchema>; | ||
@@ -6,0 +6,0 @@ export type ModelProvider = "openai" | "anthropic"; |
@@ -84,2 +84,4 @@ import Browserbase from "@browserbasehq/sdk"; | ||
onlyVisible?: boolean; | ||
/** @deprecated `useAccessibilityTree` is now deprecated. Use `onlyVisible` instead. */ | ||
useAccessibilityTree?: boolean; | ||
} | ||
@@ -86,0 +88,0 @@ export interface ObserveResult { |
@@ -143,5 +143,4 @@ import { Locator, Page } from "@playwright/test"; | ||
if ( | ||
llmClient.modelName === "o1-mini" || | ||
llmClient.modelName === "o1-preview" || | ||
llmClient.modelName.startsWith("o1-") | ||
llmClient.modelName.startsWith("o1") || | ||
llmClient.modelName.startsWith("o3") | ||
) { | ||
@@ -148,0 +147,0 @@ verifyLLmClient = this.llmProvider.getClient( |
@@ -26,11 +26,2 @@ import { ZodType } from "zod"; | ||
export const modelsWithVision: AvailableModel[] = [ | ||
"gpt-4o", | ||
"gpt-4o-mini", | ||
"claude-3-5-sonnet-latest", | ||
"claude-3-5-sonnet-20240620", | ||
"claude-3-5-sonnet-20241022", | ||
"gpt-4o-2024-08-06", | ||
]; | ||
export const AnnotatedScreenshotText = | ||
@@ -102,3 +93,2 @@ "This is a screenshot of the current page state with the elements annotated on it. Each element id is annotated with a number to the top left of it. Duplicate annotations at the same location are under each other vertically."; | ||
this.modelName = modelName; | ||
this.hasVision = modelsWithVision.includes(modelName); | ||
this.userProvidedInstructions = userProvidedInstructions; | ||
@@ -105,0 +95,0 @@ } |
@@ -19,2 +19,3 @@ import { LogLine } from "../../types/log"; | ||
"o1-preview": "openai", | ||
"o3-mini": "openai", | ||
"claude-3-5-sonnet-latest": "anthropic", | ||
@@ -21,0 +22,0 @@ "claude-3-5-sonnet-20240620": "anthropic", |
@@ -62,3 +62,3 @@ import OpenAI, { ClientOptions } from "openai"; | ||
let isToolsOverridedForO1 = false; | ||
if (this.modelName === "o1-mini" || this.modelName === "o1-preview") { | ||
if (this.modelName.startsWith("o1") || this.modelName.startsWith("o3")) { | ||
/* eslint-disable */ | ||
@@ -115,3 +115,3 @@ // Remove unsupported options | ||
options.temperature && | ||
(this.modelName === "o1-mini" || this.modelName === "o1-preview") | ||
(this.modelName.startsWith("o1") || this.modelName.startsWith("o3")) | ||
) { | ||
@@ -212,3 +212,3 @@ throw new Error("Temperature is not supported for o1 models"); | ||
// For O1 models, we need to add the schema as a user message. | ||
if (this.modelName === "o1-mini" || this.modelName === "o1-preview") { | ||
if (this.modelName.startsWith("o1") || this.modelName.startsWith("o3")) { | ||
try { | ||
@@ -215,0 +215,0 @@ const parsedSchema = JSON.stringify( |
@@ -507,4 +507,20 @@ import type { | ||
onlyVisible = false, | ||
useAccessibilityTree, | ||
} = options; | ||
if (useAccessibilityTree !== undefined) { | ||
this.stagehand.log({ | ||
category: "deprecation", | ||
message: | ||
"useAccessibilityTree is deprecated.\n" + | ||
" To use accessibility tree as context:\n" + | ||
" 1. Set onlyVisible to false (default)\n" + | ||
" 2. Don't declare useAccessibilityTree", | ||
level: 1, | ||
}); | ||
throw new Error( | ||
"useAccessibilityTree is deprecated. Use onlyVisible instead.", | ||
); | ||
} | ||
if (typeof useVision !== "undefined") { | ||
@@ -511,0 +527,0 @@ this.stagehand.log({ |
{ | ||
"name": "@browserbasehq/stagehand", | ||
"version": "1.12.0-alpha-1032d7d7d9c1ef8f30183c9019ea8324f1bdd5c6", | ||
"version": "1.12.0-alpha-16837ece839e192fbf7b68bec128dd02f22c2613", | ||
"description": "An AI web browsing framework focused on simplicity and extensibility.", | ||
@@ -55,2 +55,3 @@ "main": "./dist/index.js", | ||
"braintrust": "^0.0.171", | ||
"chalk": "^5.4.1", | ||
"cheerio": "^1.0.0", | ||
@@ -57,0 +58,0 @@ "chromium-bidi": "^0.10.0", |
Sorry, the diff of this file is too big to display
587164
182
15340
28