Skip to content

Commit c9beb52

Browse files
committed
refactor!: improve types in platform api (#376)
I was just tired of doing those `assert($response instanceof ...);` statements also resolves the special status of `AsyncResponse` by decoupling it from the `ResponseInterface` WDYT?
1 parent 31d5e32 commit c9beb52

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Profiler/TraceablePlatform.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\AI\Platform\Message\Content\File;
1515
use Symfony\AI\Platform\Model;
1616
use Symfony\AI\Platform\PlatformInterface;
17-
use Symfony\AI\Platform\Response\ResponseInterface;
17+
use Symfony\AI\Platform\Response\ResponsePromise;
1818

1919
/**
2020
* @author Christopher Hertel <[email protected]>
@@ -23,7 +23,7 @@
2323
* model: Model,
2424
* input: array<mixed>|string|object,
2525
* options: array<string, mixed>,
26-
* response: ResponseInterface,
26+
* response: ResponsePromise,
2727
* }
2828
*/
2929
final class TraceablePlatform implements PlatformInterface
@@ -38,7 +38,7 @@ public function __construct(
3838
) {
3939
}
4040

41-
public function request(Model $model, array|string|object $input, array $options = []): ResponseInterface
41+
public function request(Model $model, array|string|object $input, array $options = []): ResponsePromise
4242
{
4343
$response = $this->platform->request($model, $input, $options);
4444

@@ -50,7 +50,7 @@ public function request(Model $model, array|string|object $input, array $options
5050
'model' => $model,
5151
'input' => \is_object($input) ? clone $input : $input,
5252
'options' => $options,
53-
'response' => $response->getContent(),
53+
'response' => $response,
5454
];
5555

5656
return $response;

0 commit comments

Comments
 (0)