1111
1212namespace Symfony \AI \Platform \Result ;
1313
14+ use Symfony \AI \Platform \Exception \ExceptionInterface ;
1415use Symfony \AI \Platform \Exception \UnexpectedResultTypeException ;
1516use 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 {
0 commit comments