Skip to content

Commit 10ce6b3

Browse files
Improve ResultConverter phpdoc
1 parent 64eef5e commit 10ce6b3

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/agent/src/Agent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\AI\Agent\Exception\MissingModelSupportException;
1818
use Symfony\AI\Agent\Exception\RuntimeException;
1919
use Symfony\AI\Platform\Capability;
20+
use Symfony\AI\Platform\Exception\ExceptionInterface;
2021
use Symfony\AI\Platform\Message\MessageBag;
2122
use Symfony\AI\Platform\Model;
2223
use Symfony\AI\Platform\PlatformInterface;
@@ -72,6 +73,7 @@ public function getName(): string
7273
* @throws MissingModelSupportException When the model doesn't support audio or image inputs present in the messages
7374
* @throws InvalidArgumentException When the platform returns a client error (4xx) indicating invalid request parameters
7475
* @throws RuntimeException When the platform returns a server error (5xx) or network failure occurs
76+
* @throws ExceptionInterface When the platform converter throws an exception
7577
*/
7678
public function call(MessageBag $messages, array $options = []): ResultInterface
7779
{

src/platform/src/Result/ResultPromise.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\AI\Platform\Result;
1313

14+
use Symfony\AI\Platform\Exception\ExceptionInterface;
1415
use Symfony\AI\Platform\Exception\UnexpectedResultTypeException;
1516
use Symfony\AI\Platform\Vector\Vector;
1617

@@ -32,6 +33,9 @@ public function __construct(
3233
) {
3334
}
3435

36+
/**
37+
* @throws ExceptionInterface
38+
*/
3539
public function getResult(): ResultInterface
3640
{
3741
return $this->await();
@@ -42,6 +46,9 @@ public function getRawResult(): RawResultInterface
4246
return $this->rawResult;
4347
}
4448

49+
/**
50+
* @throws ExceptionInterface
51+
*/
4552
public function await(): ResultInterface
4653
{
4754
if (!$this->isConverted) {
@@ -58,21 +65,33 @@ public function await(): ResultInterface
5865
return $this->convertedResult;
5966
}
6067

68+
/**
69+
* @throws ExceptionInterface
70+
*/
6171
public function asText(): string
6272
{
6373
return $this->as(TextResult::class)->getContent();
6474
}
6575

76+
/**
77+
* @throws ExceptionInterface
78+
*/
6679
public function asObject(): object
6780
{
6881
return $this->as(ObjectResult::class)->getContent();
6982
}
7083

84+
/**
85+
* @throws ExceptionInterface
86+
*/
7187
public function asBinary(): string
7288
{
7389
return $this->as(BinaryResult::class)->getContent();
7490
}
7591

92+
/**
93+
* @throws ExceptionInterface
94+
*/
7695
public function asBase64(): string
7796
{
7897
$result = $this->as(BinaryResult::class);
@@ -84,19 +103,26 @@ public function asBase64(): string
84103

85104
/**
86105
* @return Vector[]
106+
*
107+
* @throws ExceptionInterface
87108
*/
88109
public function asVectors(): array
89110
{
90111
return $this->as(VectorResult::class)->getContent();
91112
}
92113

114+
/**
115+
* @throws ExceptionInterface
116+
*/
93117
public function asStream(): \Generator
94118
{
95119
yield from $this->as(StreamResult::class)->getContent();
96120
}
97121

98122
/**
99123
* @return ToolCall[]
124+
*
125+
* @throws ExceptionInterface
100126
*/
101127
public function asToolCalls(): array
102128
{
@@ -105,6 +131,8 @@ public function asToolCalls(): array
105131

106132
/**
107133
* @param class-string $type
134+
*
135+
* @throws ExceptionInterface
108136
*/
109137
private function as(string $type): ResultInterface
110138
{

src/platform/src/ResultConverterInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\AI\Platform;
1313

14+
use Symfony\AI\Platform\Exception\ExceptionInterface;
1415
use Symfony\AI\Platform\Result\RawResultInterface;
1516
use Symfony\AI\Platform\Result\ResultInterface;
1617

@@ -23,6 +24,8 @@ public function supports(Model $model): bool;
2324

2425
/**
2526
* @param array<string, mixed> $options
27+
*
28+
* @throws ExceptionInterface
2629
*/
2730
public function convert(RawResultInterface $result, array $options = []): ResultInterface;
2831
}

0 commit comments

Comments
 (0)