@@ -91,11 +91,10 @@ async function openAIAgentLoop(page: playwright.Page, task: string) {
9191 model : 'gpt-4o' ,
9292 messages : toOpenAIMessages ( history ) ,
9393 tools,
94+ tool_choice : 'required' ,
9495 store : true ,
9596 } ) ;
9697
97- console . log ( JSON . stringify ( completion , null , 2 ) ) ;
98-
9998 const toolCalls = completion . choices [ 0 ] ?. message ?. tool_calls ;
10099 if ( ! toolCalls || toolCalls . length !== 1 || toolCalls [ 0 ] . type !== 'function' ) {
101100 history . push ( { role : 'user' , content : 'expected exactly one tool call' , history : 'expected exactly one tool call' } ) ;
@@ -113,7 +112,6 @@ async function openAIAgentLoop(page: playwright.Page, task: string) {
113112 // Run the Playwright tool.
114113 const params = JSON . parse ( toolCall . function . arguments ) ;
115114 const { error, snapshot, code } = await browser . call ( page , toolCall . function . name , params ) ;
116- console . log ( { error, code, snapshot } ) ;
117115 if ( code . length )
118116 console . log ( code . join ( '\n' ) ) ;
119117
@@ -149,9 +147,6 @@ async function main() {
149147 - Go to http://github.com/microsoft
150148 - Search for "playwright" repository
151149 - Navigate to it
152- - Capture snapshot for toolbar with Code, Issues, etc.
153- - Capture snapshot for branch selector
154- - Assert that number of Issues is present
155150 - Switch into the Issues tab
156151 - Report 3 first issues
157152 ` ) ;
0 commit comments