Skip to content

Commit c5b96e3

Browse files
committed
Remove Symfony 6.4 compatibility code
Remove try-catch blocks for JsonException that were only needed for Symfony 6.4 compatibility in stream processing methods.
1 parent 2a91f76 commit c5b96e3

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/platform/src/Bridge/DockerModelRunner/Completions/ResultConverter.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Symfony\AI\Platform\ResultConverterInterface;
2929
use Symfony\Component\HttpClient\Chunk\ServerSentEvent;
3030
use Symfony\Component\HttpClient\EventSourceHttpClient;
31-
use Symfony\Component\HttpClient\Exception\JsonException;
3231
use Symfony\Contracts\HttpClient\ResponseInterface as HttpResponse;
3332

3433
/**
@@ -79,12 +78,7 @@ private function convertStream(HttpResponse $result): \Generator
7978
continue;
8079
}
8180

82-
try {
83-
$data = $chunk->getArrayData();
84-
} catch (JsonException) {
85-
// try catch only needed for Symfony 6.4
86-
continue;
87-
}
81+
$data = $chunk->getArrayData();
8882

8983
if ($this->streamIsToolCall($data)) {
9084
$toolCalls = $this->convertStreamToToolCalls($toolCalls, $data);

src/platform/src/Bridge/Scaleway/Llm/ResultConverter.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use Symfony\AI\Platform\ResultConverterInterface;
2727
use Symfony\Component\HttpClient\Chunk\ServerSentEvent;
2828
use Symfony\Component\HttpClient\EventSourceHttpClient;
29-
use Symfony\Component\HttpClient\Exception\JsonException;
3029
use Symfony\Contracts\HttpClient\ResponseInterface as HttpResponse;
3130

3231
/**
@@ -67,12 +66,7 @@ private function convertStream(HttpResponse $result): \Generator
6766
continue;
6867
}
6968

70-
try {
71-
$data = $chunk->getArrayData();
72-
} catch (JsonException) {
73-
// try catch only needed for Symfony 6.4
74-
continue;
75-
}
69+
$data = $chunk->getArrayData();
7670

7771
if ($this->streamIsToolCall($data)) {
7872
$toolCalls = $this->convertStreamToToolCalls($toolCalls, $data);

0 commit comments

Comments
 (0)