forked from symfony/ai-bedrock-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRawBedrockResult.php
More file actions
42 lines (35 loc) · 1.05 KB
/
RawBedrockResult.php
File metadata and controls
42 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\AI\Platform\Bridge\Bedrock;
use AsyncAws\BedrockRuntime\Result\InvokeModelResponse;
use Symfony\AI\Platform\Exception\RuntimeException;
use Symfony\AI\Platform\Result\RawResultInterface;
/**
* @author Christopher Hertel <mail@christopher-hertel.de>
*/
final class RawBedrockResult implements RawResultInterface
{
public function __construct(
private readonly InvokeModelResponse $invokeModelResponse,
) {
}
public function getData(): array
{
return json_decode($this->invokeModelResponse->getBody(), true, 512, \JSON_THROW_ON_ERROR);
}
public function getDataStream(): iterable
{
throw new RuntimeException('Streaming is not implemented yet.');
}
public function getObject(): InvokeModelResponse
{
return $this->invokeModelResponse;
}
}