@@ -91,11 +91,10 @@ async function openAIAgentLoop(page: playwright.Page, task: string) {
91
91
model : 'gpt-4o' ,
92
92
messages : toOpenAIMessages ( history ) ,
93
93
tools,
94
+ tool_choice : 'required' ,
94
95
store : true ,
95
96
} ) ;
96
97
97
- console . log ( JSON . stringify ( completion , null , 2 ) ) ;
98
-
99
98
const toolCalls = completion . choices [ 0 ] ?. message ?. tool_calls ;
100
99
if ( ! toolCalls || toolCalls . length !== 1 || toolCalls [ 0 ] . type !== 'function' ) {
101
100
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) {
113
112
// Run the Playwright tool.
114
113
const params = JSON . parse ( toolCall . function . arguments ) ;
115
114
const { error, snapshot, code } = await browser . call ( page , toolCall . function . name , params ) ;
116
- console . log ( { error, code, snapshot } ) ;
117
115
if ( code . length )
118
116
console . log ( code . join ( '\n' ) ) ;
119
117
@@ -149,9 +147,6 @@ async function main() {
149
147
- Go to http://github.com/microsoft
150
148
- Search for "playwright" repository
151
149
- 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
155
150
- Switch into the Issues tab
156
151
- Report 3 first issues
157
152
` ) ;
0 commit comments