@@ -88,9 +88,9 @@ public function search(array $params = []): array
8888 public function stream (string $ threadId , array $ params , ?callable $ callback = null ): \Generator
8989 {
9090 $ streamParams = array_merge ($ params , ['stream ' => true ]);
91-
91+
9292 $ stream = $ this ->httpClient ->stream ("threads/ {$ threadId }/runs " , 'POST ' , $ streamParams );
93-
93+
9494 foreach ($ stream as $ event ) {
9595 if ($ callback !== null ) {
9696 $ callback ($ event );
@@ -105,9 +105,9 @@ public function stream(string $threadId, array $params, ?callable $callback = nu
105105 public function streamStateless (array $ params , ?callable $ callback = null ): \Generator
106106 {
107107 $ streamParams = array_merge ($ params , ['stream ' => true ]);
108-
108+
109109 $ stream = $ this ->httpClient ->stream ('runs ' , 'POST ' , $ streamParams );
110-
110+
111111 foreach ($ stream as $ event ) {
112112 if ($ callback !== null ) {
113113 $ callback ($ event );
@@ -126,7 +126,7 @@ public function wait(string $threadId, array $params, int $pollInterval = 1): ar
126126
127127 while (true ) {
128128 $ currentRun = $ this ->get ($ threadId , $ runId );
129-
129+
130130 if (in_array ($ currentRun ['status ' ], ['success ' , 'error ' , 'cancelled ' , 'failed ' ])) {
131131 return $ currentRun ;
132132 }
@@ -146,7 +146,7 @@ public function waitStateless(array $params, int $pollInterval = 1): array
146146 while (true ) {
147147 // For stateless runs, we need to check via a different endpoint
148148 $ currentRun = $ this ->getStateless ($ runId );
149-
149+
150150 if (in_array ($ currentRun ['status ' ], ['success ' , 'error ' , 'cancelled ' , 'failed ' ])) {
151151 return $ currentRun ;
152152 }
@@ -177,12 +177,12 @@ public function join(string $threadId, string $runId): array
177177 public function joinStream (string $ threadId , string $ runId , ?callable $ callback = null ): \Generator
178178 {
179179 $ stream = $ this ->httpClient ->stream ("threads/ {$ threadId }/runs/ {$ runId }/stream " , 'GET ' );
180-
180+
181181 foreach ($ stream as $ event ) {
182182 if ($ callback !== null ) {
183183 $ callback ($ event );
184184 }
185185 yield $ event ;
186186 }
187187 }
188- }
188+ }
0 commit comments