@@ -160,7 +160,7 @@ func TestCancelRun(t *testing.T) {
160160}
161161
162162func  TestAbortChatCompletionRun (t  * testing.T ) {
163- 	tool  :=  ToolDef {Instructions : "What is the capital of  the united states? " }
163+ 	tool  :=  ToolDef {Instructions : "Generate a real long essay about  the meaning of life. " }
164164
165165	run , err  :=  g .Evaluate (context .Background (), Options {DisableCache : true , IncludeEvents : true }, tool )
166166	if  err  !=  nil  {
@@ -1404,6 +1404,53 @@ func TestPromptWithoutPromptAllowed(t *testing.T) {
14041404	}
14051405}
14061406
1407+ func  TestPromptWithOptions (t  * testing.T ) {
1408+ 	run , err  :=  g .Run (context .Background (), "sys.prompt" , Options {IncludeEvents : true , Prompt : true , Input : `{"fields":[{"name":"Authentication Method","description":"The authentication token for the user","options":["API Key","OAuth"]}]}` })
1409+ 	if  err  !=  nil  {
1410+ 		t .Errorf ("Error executing tool: %v" , err )
1411+ 	}
1412+ 
1413+ 	// Wait for the prompt event 
1414+ 	var  promptFrame  * PromptFrame 
1415+ 	for  e  :=  range  run .Events () {
1416+ 		if  e .Prompt  !=  nil  {
1417+ 			if  e .Prompt .Type  ==  EventTypePrompt  {
1418+ 				promptFrame  =  e .Prompt 
1419+ 				break 
1420+ 			}
1421+ 		}
1422+ 	}
1423+ 
1424+ 	if  promptFrame  ==  nil  {
1425+ 		t .Fatalf ("No prompt call event" )
1426+ 		return 
1427+ 	}
1428+ 
1429+ 	if  len (promptFrame .Fields ) !=  1  {
1430+ 		t .Fatalf ("Unexpected number of fields: %d" , len (promptFrame .Fields ))
1431+ 	}
1432+ 
1433+ 	if  promptFrame .Fields [0 ].Name  !=  "Authentication Method"  {
1434+ 		t .Errorf ("Unexpected field: %s" , promptFrame .Fields [0 ].Name )
1435+ 	}
1436+ 
1437+ 	if  promptFrame .Fields [0 ].Description  !=  "The authentication token for the user"  {
1438+ 		t .Errorf ("Unexpected description: %s" , promptFrame .Fields [0 ].Description )
1439+ 	}
1440+ 
1441+ 	if  len (promptFrame .Fields [0 ].Options ) !=  2  {
1442+ 		t .Fatalf ("Unexpected number of options: %d" , len (promptFrame .Fields [0 ].Options ))
1443+ 	}
1444+ 
1445+ 	if  promptFrame .Fields [0 ].Options [0 ] !=  "API Key"  {
1446+ 		t .Errorf ("Unexpected option: %s" , promptFrame .Fields [0 ].Options [0 ])
1447+ 	}
1448+ 
1449+ 	if  promptFrame .Fields [0 ].Options [1 ] !=  "OAuth"  {
1450+ 		t .Errorf ("Unexpected option: %s" , promptFrame .Fields [0 ].Options [1 ])
1451+ 	}
1452+ }
1453+ 
14071454func  TestGetCommand (t  * testing.T ) {
14081455	currentEnvVar  :=  os .Getenv ("GPTSCRIPT_BIN" )
14091456	t .Cleanup (func () {
0 commit comments