File tree 7 files changed +17
-17
lines changed
7 files changed +17
-17
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @browserbasehq/stagehand " : minor
3
+ ---
4
+
5
+ add o3-mini to availablemodel
Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ import { Stagehand } from "@/dist";
9
9
import StagehandConfig from "@/stagehand.config" ;
10
10
11
11
async function example ( ) {
12
- const stagehand = new Stagehand ( StagehandConfig ) ;
12
+ const stagehand = new Stagehand ( {
13
+ ...StagehandConfig ,
14
+ modelName : "o3-mini" ,
15
+ } ) ;
13
16
await stagehand . init ( ) ;
17
+ await stagehand . page . goto ( "https://www.google.com" ) ;
14
18
}
15
19
16
20
( async ( ) => {
Original file line number Diff line number Diff line change @@ -140,9 +140,8 @@ export class StagehandActHandler {
140
140
// o1 is overkill for this task + this task uses a lot of tokens. So we switch it 4o
141
141
let verifyLLmClient = llmClient ;
142
142
if (
143
- llmClient . modelName === "o1-mini" ||
144
- llmClient . modelName === "o1-preview" ||
145
- llmClient . modelName . startsWith ( "o1-" )
143
+ llmClient . modelName . startsWith ( "o1" ) ||
144
+ llmClient . modelName . startsWith ( "o3" )
146
145
) {
147
146
verifyLLmClient = this . llmProvider . getClient (
148
147
"gpt-4o" ,
Original file line number Diff line number Diff line change @@ -23,15 +23,6 @@ export interface ChatMessageTextContent {
23
23
text : string ;
24
24
}
25
25
26
- export const modelsWithVision : AvailableModel [ ] = [
27
- "gpt-4o" ,
28
- "gpt-4o-mini" ,
29
- "claude-3-5-sonnet-latest" ,
30
- "claude-3-5-sonnet-20240620" ,
31
- "claude-3-5-sonnet-20241022" ,
32
- "gpt-4o-2024-08-06" ,
33
- ] ;
34
-
35
26
export const AnnotatedScreenshotText =
36
27
"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." ;
37
28
@@ -98,7 +89,6 @@ export abstract class LLMClient {
98
89
99
90
constructor ( modelName : AvailableModel , userProvidedInstructions ?: string ) {
100
91
this . modelName = modelName ;
101
- this . hasVision = modelsWithVision . includes ( modelName ) ;
102
92
this . userProvidedInstructions = userProvidedInstructions ;
103
93
}
104
94
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export class LLMProvider {
16
16
"gpt-4o-2024-08-06" : "openai" ,
17
17
"o1-mini" : "openai" ,
18
18
"o1-preview" : "openai" ,
19
+ "o3-mini" : "openai" ,
19
20
"claude-3-5-sonnet-latest" : "anthropic" ,
20
21
"claude-3-5-sonnet-20240620" : "anthropic" ,
21
22
"claude-3-5-sonnet-20241022" : "anthropic" ,
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ export class OpenAIClient extends LLMClient {
59
59
// O1 models do not support most of the options. So we override them.
60
60
// For schema and tools, we add them as user messages.
61
61
let isToolsOverridedForO1 = false ;
62
- if ( this . modelName === "o1-mini" || this . modelName === "o1-preview" ) {
62
+ if ( this . modelName . startsWith ( "o1" ) || this . modelName . startsWith ( "o3" ) ) {
63
63
/* eslint-disable */
64
64
// Remove unsupported options
65
65
let {
@@ -111,7 +111,7 @@ export class OpenAIClient extends LLMClient {
111
111
}
112
112
if (
113
113
options . temperature &&
114
- ( this . modelName === "o1-mini" || this . modelName === "o1-preview" )
114
+ ( this . modelName . startsWith ( "o1" ) || this . modelName . startsWith ( "o3" ) )
115
115
) {
116
116
throw new Error ( "Temperature is not supported for o1 models" ) ;
117
117
}
@@ -207,7 +207,7 @@ export class OpenAIClient extends LLMClient {
207
207
let responseFormat = undefined ;
208
208
if ( options . response_model ) {
209
209
// For O1 models, we need to add the schema as a user message.
210
- if ( this . modelName === "o1-mini" || this . modelName === "o1-preview" ) {
210
+ if ( this . modelName . startsWith ( "o1" ) || this . modelName . startsWith ( "o3" ) ) {
211
211
try {
212
212
const parsedSchema = JSON . stringify (
213
213
zodToJsonSchema ( options . response_model . schema ) ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export const AvailableModelSchema = z.enum([
11
11
"claude-3-5-sonnet-20240620" ,
12
12
"o1-mini" ,
13
13
"o1-preview" ,
14
+ "o3-mini" ,
14
15
] ) ;
15
16
16
17
export type AvailableModel = z . infer < typeof AvailableModelSchema > ;
You can’t perform that action at this time.
0 commit comments