File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 11<?php
22
3+ declare (strict_types=1 );
4+
35namespace NeuronAI \RAG \Embeddings ;
46
57use Aws \BedrockRuntime \BedrockRuntimeClient ;
@@ -9,20 +11,20 @@ class AwsBedrockEmbeddingsProvider extends AbstractEmbeddingsProvider
911 public function __construct (
1012 protected BedrockRuntimeClient $ bedrockRuntimeClient ,
1113 protected string $ model = 'amazon.titan-embed-text-v2:0 ' ,
12- ){
14+ ) {
1315 }
1416
1517 public function embedText (string $ text ): array
1618 {
1719 $ response = $ this ->bedrockRuntimeClient ->invokeModel ([
1820 'modelId ' => $ this ->model ,
1921 'contentType ' => 'application/json ' ,
20- 'body ' => json_encode ([
22+ 'body ' => \ json_encode ([
2123 'inputText ' => $ text ,
2224 ]),
2325 ]);
2426
25- $ response = json_decode ($ response ['body ' ], true );
27+ $ response = \ json_decode (( string ) $ response ['body ' ], true );
2628
2729 return $ response ['embedding ' ];
2830 }
You can’t perform that action at this time.
0 commit comments