@@ -28,7 +28,7 @@ class User {
2828 public string $ name ;
2929}
3030
31- // CASE 1 - normal flow
31+ // CASE 1.1 - normal flow, sync request
3232
3333$ instructor = (new Instructor )->withConnection ('openai ' );
3434
@@ -42,6 +42,13 @@ class User {
4242echo "\nResult: \n" ;
4343dump ($ user );
4444
45+ assert (isset ($ user ->name ));
46+ assert (isset ($ user ->age ));
47+ assert ($ user ->name === 'Jason ' );
48+ assert ($ user ->age === 25 );
49+
50+ // CASE 1.2 - normal flow, streaming request
51+
4552echo "\n### CASE 1.2 - Debugging streaming request \n\n" ;
4653$ user2 = $ instructor ->withDebug ()->respond (
4754 messages: "Anna is 21 years old. " ,
@@ -52,11 +59,6 @@ class User {
5259echo "\nResult: \n" ;
5360dump ($ user2 );
5461
55- assert (isset ($ user ->name ));
56- assert (isset ($ user ->age ));
57- assert ($ user ->name === 'Jason ' );
58- assert ($ user ->age === 25 );
59-
6062assert (isset ($ user2 ->name ));
6163assert (isset ($ user2 ->age ));
6264assert ($ user2 ->name === 'Anna ' );
@@ -65,9 +67,9 @@ class User {
6567
6668// CASE 2 - forcing API error via empty LLM config
6769
68- $ instructor = (new Instructor )->withLLMConfig (new LLMConfig ());
70+ $ instructor = (new Instructor )->withLLMConfig (new LLMConfig (apiUrl: ' https://wrong.com ' ));
6971
70- echo "\n### CASE 2 - Debugging exception \n\n" ;
72+ echo "\n### CASE 2 - Debugging with HTTP exception \n\n" ;
7173try {
7274 $ user = $ instructor ->withDebug ()->respond (
7375 messages: "Jason is 25 years old. " ,
0 commit comments