diff --git a/php/example_code/bedrock-runtime/BedrockRuntimeService.php b/php/example_code/bedrock-runtime/BedrockRuntimeService.php index 1940fbe2c38..bcbf48a1bd0 100644 --- a/php/example_code/bedrock-runtime/BedrockRuntimeService.php +++ b/php/example_code/bedrock-runtime/BedrockRuntimeService.php @@ -1,65 +1,57 @@ bedrockRuntimeClient = $client; - return; + } else { + $this->bedrockRuntimeClient = new BedrockRuntimeClient([ + 'region' => 'us-east-1', + 'profile' => 'default' + ]); } - $this->bedrockRuntimeClient = new BedrockRuntimeClient([ - 'region' => $region, - 'version' => $version, - 'profile' => $profile, - ]); } - #snippet-start:[php.example_code.bedrock-runtime.service.invokeClaude] + public function getClient(): BedrockRuntimeClient + { + return $this->bedrockRuntimeClient; + } + + // snippet-start:[php.example_code.bedrock-runtime.service.invokeClaude] public function invokeClaude($prompt) { - # The different model providers have individual request and response formats. - # For the format, ranges, and default values for Anthropic Claude, refer to: - # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html + // The different model providers have individual request and response formats. + // For the format, ranges, and default values for Anthropic Claude, refer to: + // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html $completion = ""; - try { $modelId = 'anthropic.claude-v2'; - - # Claude requires you to enclose the prompt as follows: + // Claude requires you to enclose the prompt as follows: $prompt = "\n\nHuman: {$prompt}\n\nAssistant:"; - $body = [ 'prompt' => $prompt, 'max_tokens_to_sample' => 200, 'temperature' => 0.5, 'stop_sequences' => ["\n\nHuman:"], ]; - $result = $this->bedrockRuntimeClient->invokeModel([ 'contentType' => 'application/json', 'body' => json_encode($body), 'modelId' => $modelId, ]); - $response_body = json_decode($result['body']); - $completion = $response_body->completion; } catch (Exception $e) { echo "Error: ({$e->getCode()}) - {$e->getMessage()}\n"; @@ -67,9 +59,9 @@ public function invokeClaude($prompt) return $completion; } - #snippet-end:[php.example_code.bedrock-runtime.service.invokeClaude] + // snippet-end:[php.example_code.bedrock-runtime.service.invokeClaude] - #snippet-start:[php.example_code.bedrock-runtime.service.invokeJurassic2] + // snippet-start:[php.example_code.bedrock-runtime.service.invokeJurassic2] public function invokeJurassic2($prompt) { # The different model providers have individual request and response formats. @@ -77,24 +69,19 @@ public function invokeJurassic2($prompt) # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-jurassic2.html $completion = ""; - try { $modelId = 'ai21.j2-mid-v1'; - $body = [ 'prompt' => $prompt, 'temperature' => 0.5, 'maxTokens' => 200, ]; - $result = $this->bedrockRuntimeClient->invokeModel([ 'contentType' => 'application/json', 'body' => json_encode($body), 'modelId' => $modelId, ]); - $response_body = json_decode($result['body']); - $completion = $response_body->completions[0]->data->text; } catch (Exception $e) { echo "Error: ({$e->getCode()}) - {$e->getMessage()}\n"; @@ -102,34 +89,29 @@ public function invokeJurassic2($prompt) return $completion; } - #snippet-end:[php.example_code.bedrock-runtime.service.invokeJurassic2] + // snippet-end:[php.example_code.bedrock-runtime.service.invokeJurassic2] - #snippet-start:[php.example_code.bedrock-runtime.service.invokeLlama2] + // snippet-start:[php.example_code.bedrock-runtime.service.invokeLlama2] public function invokeLlama2($prompt) { - # The different model providers have individual request and response formats. - # For the format, ranges, and default values for Meta Llama 2 Chat, refer to: - # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html + // The different model providers have individual request and response formats. + // For the format, ranges, and default values for Meta Llama 2 Chat, refer to: + // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html $completion = ""; - try { $modelId = 'meta.llama2-13b-chat-v1'; - $body = [ 'prompt' => $prompt, 'temperature' => 0.5, 'max_gen_len' => 512, ]; - $result = $this->bedrockRuntimeClient->invokeModel([ 'contentType' => 'application/json', 'body' => json_encode($body), 'modelId' => $modelId, ]); - $response_body = json_decode($result['body']); - $completion = $response_body->generation; } catch (Exception $e) { echo "Error: ({$e->getCode()}) - {$e->getMessage()}\n"; @@ -137,20 +119,18 @@ public function invokeLlama2($prompt) return $completion; } - #snippet-end:[php.example_code.bedrock-runtime.service.invokeLlama2] + // snippet-end:[php.example_code.bedrock-runtime.service.invokeLlama2] - #snippet-start:[php.example_code.bedrock-runtime.service.invokeStableDiffusion] + // snippet-start:[php.example_code.bedrock-runtime.service.invokeStableDiffusion] public function invokeStableDiffusion(string $prompt, int $seed, string $style_preset) { - # The different model providers have individual request and response formats. - # For the format, ranges, and available style_presets of Stable Diffusion models refer to: - # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html + // The different model providers have individual request and response formats. + // For the format, ranges, and available style_presets of Stable Diffusion models refer to: + // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html $base64_image_data = ""; - try { - $modelId = 'stability.stable-diffusion-xl'; - + $modelId = 'stability.stable-diffusion-xl-v1'; $body = [ 'text_prompts' => [ ['text' => $prompt] @@ -159,7 +139,6 @@ public function invokeStableDiffusion(string $prompt, int $seed, string $style_p 'cfg_scale' => 10, 'steps' => 30 ]; - if ($style_preset) { $body['style_preset'] = $style_preset; } @@ -169,9 +148,7 @@ public function invokeStableDiffusion(string $prompt, int $seed, string $style_p 'body' => json_encode($body), 'modelId' => $modelId, ]); - $response_body = json_decode($result['body']); - $base64_image_data = $response_body->artifacts[0]->base64; } catch (Exception $e) { echo "Error: ({$e->getCode()}) - {$e->getMessage()}\n"; @@ -179,20 +156,18 @@ public function invokeStableDiffusion(string $prompt, int $seed, string $style_p return $base64_image_data; } - #snippet-end:[php.example_code.bedrock-runtime.service.invokeStableDiffusion] + // snippet-end:[php.example_code.bedrock-runtime.service.invokeStableDiffusion] - #snippet-start:[php.example_code.bedrock-runtime.service.invokeTitanImage] + // snippet-start:[php.example_code.bedrock-runtime.service.invokeTitanImage] public function invokeTitanImage(string $prompt, int $seed) { - # The different model providers have individual request and response formats. - # For the format, ranges, and default values for Titan Image models refer to: - # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-image.html + // The different model providers have individual request and response formats. + // For the format, ranges, and default values for Titan Image models refer to: + // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-image.html $base64_image_data = ""; - try { $modelId = 'amazon.titan-image-generator-v1'; - $request = json_encode([ 'taskType' => 'TEXT_IMAGE', 'textToImageParams' => [ @@ -207,15 +182,12 @@ public function invokeTitanImage(string $prompt, int $seed) 'seed' => $seed ] ]); - $result = $this->bedrockRuntimeClient->invokeModel([ 'contentType' => 'application/json', 'body' => $request, 'modelId' => $modelId, ]); - $response_body = json_decode($result['body']); - $base64_image_data = $response_body->images[0]; } catch (Exception $e) { echo "Error: ({$e->getCode()}) - {$e->getMessage()}\n"; @@ -223,7 +195,6 @@ public function invokeTitanImage(string $prompt, int $seed) return $base64_image_data; } - #snippet-end:[php.example_code.bedrock-runtime.service.invokeTitanImage] + // snippet-end:[php.example_code.bedrock-runtime.service.invokeTitanImage] } - -#snippet-end:[php.example_code.bedrock-runtime.service] +// snippet-end:[php.example_code.bedrock-runtime.service] diff --git a/php/example_code/bedrock-runtime/GettingStartedWithBedrockRuntime.php b/php/example_code/bedrock-runtime/GettingStartedWithBedrockRuntime.php index 5861416272c..fb27160ce76 100644 --- a/php/example_code/bedrock-runtime/GettingStartedWithBedrockRuntime.php +++ b/php/example_code/bedrock-runtime/GettingStartedWithBedrockRuntime.php @@ -1,6 +1,6 @@ 'us-east-1', - 'version' => 'latest', - 'profile' => 'default', - ]; - - $bedrockRuntimeService = new BedrockRuntimeService($clientArgs); - + $bedrockRuntimeService = new BedrockRuntimeService(); $prompt = 'In one paragraph, who are you?'; - echo "\nPrompt: " . $prompt; - echo "\n\nAnthropic Claude:"; echo $bedrockRuntimeService->invokeClaude($prompt); - echo "\n\nAI21 Labs Jurassic-2: "; echo $bedrockRuntimeService->invokeJurassic2($prompt); - echo "\n\nMeta Llama 2 Chat: "; echo $bedrockRuntimeService->invokeLlama2($prompt); - echo "\n---------------------------------------------------------------------\n"; - $image_prompt = 'stylized picture of a cute old steampunk robot'; - echo "\nImage prompt: " . $image_prompt; - echo "\n\nStability.ai Stable Diffusion XL:\n"; $diffusionSeed = rand(0, 4294967295); $style_preset = 'photographic'; $base64 = $bedrockRuntimeService->invokeStableDiffusion($image_prompt, $diffusionSeed, $style_preset); $image_path = $this->saveImage($base64, 'stability.stable-diffusion-xl'); echo "The generated images have been saved to $image_path"; - echo "\n\nAmazon Titan Image Generation:\n"; $titanSeed = rand(0, 2147483647); $base64 = $bedrockRuntimeService->invokeTitanImage($image_prompt, $titanSeed); @@ -66,7 +48,6 @@ public function runExample() private function saveImage($base64_image_data, $model_id): string { $output_dir = "output"; - if (!file_exists($output_dir)) { mkdir($output_dir); } @@ -77,15 +58,11 @@ private function saveImage($base64_image_data, $model_id): string } $image_data = base64_decode($base64_image_data); - $file_path = "$output_dir/$model_id" . '_' . "$i.png"; - $file = fopen($file_path, 'wb'); fwrite($file, $image_data); fclose($file); - return $file_path; } } - -# snippet-end:[php.example_code.bedrock-runtime.basics.scenario] +// snippet-end:[php.example_code.bedrock-runtime.basics.scenario] diff --git a/php/example_code/bedrock-runtime/README.md b/php/example_code/bedrock-runtime/README.md index b726912a463..5dd7078b4a9 100644 --- a/php/example_code/bedrock-runtime/README.md +++ b/php/example_code/bedrock-runtime/README.md @@ -44,23 +44,23 @@ functions within the same service. ### AI21 Labs Jurassic-2 -- [InvokeModel](BedrockRuntimeService.php#L72) +- [InvokeModel](BedrockRuntimeService.php#L64) ### Amazon Titan Image Generator -- [InvokeModel](BedrockRuntimeService.php#L184) +- [InvokeModel](BedrockRuntimeService.php#L161) ### Anthropic Claude -- [InvokeModel](BedrockRuntimeService.php#L33) +- [InvokeModel](BedrockRuntimeService.php#L31) ### Meta Llama -- [InvokeModel: Llama 2](BedrockRuntimeService.php#L107) +- [InvokeModel: Llama 2](BedrockRuntimeService.php#L94) ### Stable Diffusion -- [InvokeModel](BedrockRuntimeService.php#L142) +- [InvokeModel](BedrockRuntimeService.php#L124) diff --git a/php/example_code/bedrock-runtime/Runner.php b/php/example_code/bedrock-runtime/Runner.php index 1c429124d1f..eb1ecaee049 100644 --- a/php/example_code/bedrock-runtime/Runner.php +++ b/php/example_code/bedrock-runtime/Runner.php @@ -5,9 +5,7 @@ use BedrockRuntime\GettingStartedWithBedrockRuntime; include __DIR__ . '/vendor/autoload.php'; - include 'GettingStartedWithBedrockRuntime.php'; - try { $runner = new GettingStartedWithBedrockRuntime(); $runner->runExample(); diff --git a/php/example_code/bedrock-runtime/composer.json b/php/example_code/bedrock-runtime/composer.json index 1b5af98ed1b..e7cc40b048a 100644 --- a/php/example_code/bedrock-runtime/composer.json +++ b/php/example_code/bedrock-runtime/composer.json @@ -1,7 +1,7 @@ { "require": { - "aws/aws-sdk-php": "^3.286", - "guzzlehttp/guzzle": "^7.8" + "aws/aws-sdk-php": "^3.324.10", + "guzzlehttp/guzzle": "^7.9.2" }, "autoload": { "psr-0": { @@ -12,4 +12,4 @@ "AwsUtilities\\": "../aws_utilities/" } } -} \ No newline at end of file +} diff --git a/php/example_code/bedrock-runtime/composer.lock b/php/example_code/bedrock-runtime/composer.lock index 664e7a1d30a..fb4fc596c65 100644 --- a/php/example_code/bedrock-runtime/composer.lock +++ b/php/example_code/bedrock-runtime/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "83f1fc7c0c3501e76eb99800da8cb537", + "content-hash": "f5911af905339ceaef8c3ec21747f45a", "packages": [ { "name": "aws/aws-crt-php", - "version": "v1.2.4", + "version": "v1.2.7", "source": { "type": "git", "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2" + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/eb0c6e4e142224a10b08f49ebf87f32611d162b2", - "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e", "shasum": "" }, "require": { @@ -56,22 +56,22 @@ ], "support": { "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.4" + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7" }, - "time": "2023-11-08T00:42:13+00:00" + "time": "2024-10-18T22:15:13+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.288.1", + "version": "3.324.10", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a1dfa12c7165de0b731ae8074c4ba1f3ae733f89" + "reference": "702da8ee8a9dbae919c3559b8f4dba61cd8355b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a1dfa12c7165de0b731ae8074c4ba1f3ae733f89", - "reference": "a1dfa12c7165de0b731ae8074c4ba1f3ae733f89", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/702da8ee8a9dbae919c3559b8f4dba61cd8355b0", + "reference": "702da8ee8a9dbae919c3559b8f4dba61cd8355b0", "shasum": "" }, "require": { @@ -124,7 +124,10 @@ ], "psr-4": { "Aws\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/data/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -151,28 +154,28 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.288.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.324.10" }, - "time": "2023-11-22T19:35:38+00:00" + "time": "2024-10-24T18:08:37+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.8.1", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -183,9 +186,9 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -263,7 +266,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -279,20 +282,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:35:24+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455", + "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455", "shasum": "" }, "require": { @@ -300,7 +303,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -346,7 +349,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.2" + "source": "https://github.com/guzzle/promises/tree/2.0.4" }, "funding": [ { @@ -362,20 +365,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:19:20+00:00" + "time": "2024-10-17T10:06:22+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -390,8 +393,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -462,7 +465,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -478,20 +481,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "mtdowling/jmespath.php", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b" + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/bbb69a935c2cbb0c03d7f481a238027430f6440b", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", "shasum": "" }, "require": { @@ -508,7 +511,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -542,9 +545,9 @@ ], "support": { "issues": "https://github.com/jmespath/jmespath.php/issues", - "source": "https://github.com/jmespath/jmespath.php/tree/2.7.0" + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" }, - "time": "2023-08-25T10:54:48+00:00" + "time": "2024-09-04T18:46:31+00:00" }, { "name": "psr/http-client", @@ -600,20 +603,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -637,7 +640,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -649,9 +652,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -752,25 +755,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -799,7 +802,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" }, "funding": [ { @@ -815,24 +818,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -842,9 +845,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -882,7 +882,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -898,7 +898,7 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-09-09T11:45:10+00:00" } ], "packages-dev": [], diff --git a/php/example_code/bedrock-runtime/tests/BedrockRuntimeTests.php b/php/example_code/bedrock-runtime/tests/BedrockRuntimeTests.php index 7bbc4d0b41e..57ebef540de 100644 --- a/php/example_code/bedrock-runtime/tests/BedrockRuntimeTests.php +++ b/php/example_code/bedrock-runtime/tests/BedrockRuntimeTests.php @@ -1,34 +1,44 @@ clientArgs = [ - 'region' => 'us-west-2', - 'version' => 'latest', - 'profile' => 'default', - ]; - $this->bedrockRuntimeService = new BedrockRuntimeService($this->clientArgs); + $this->bedrockRuntimeService = new BedrockRuntimeService(); + } + + public function test_default_constructor_creates_client() + { + $service = new BedrockRuntimeService(); + self::assertNotNull($service->getClient()); + self::assertEquals('us-east-1', $service->getClient()->getRegion()); + } + + public function test_constructor_uses_injected_client() + { + $client = new BedrockRuntimeClient([ + 'region' => 'us-west-2' + ]); + $service = new BedrockRuntimeService($client); + self::assertNotNull($service->getClient()); + self::assertEquals($client, $service->getClient()); } public function test_claude_can_be_invoked() diff --git a/php/example_code/bedrock/BedrockService.php b/php/example_code/bedrock/BedrockService.php index a2905c263e8..cafc8527e40 100644 --- a/php/example_code/bedrock/BedrockService.php +++ b/php/example_code/bedrock/BedrockService.php @@ -1,39 +1,25 @@ bedrockClient = $client; - return; - } - $this->bedrockClient = new BedrockClient([ - 'region' => $region, - 'version' => $version, - 'profile' => $profile, - ]); - } - - #snippet-start:[php.example_code.bedrock.service.listFoundationModels] + // snippet-start:[php.example_code.bedrock.service.listFoundationModels] public function listFoundationModels() { - $result = $this->bedrockClient->listFoundationModels(); - return $result; + $bedrockClient = new BedrockClient([ + 'region' => 'us-west-2', + 'profile' => 'default' + ]); + $response = $bedrockClient->listFoundationModels(); + return $response['modelSummaries']; } - #snippet-end:[php.example_code.bedrock.service.listFoundationModels] + // snippet-end:[php.example_code.bedrock.service.listFoundationModels] } -#snippet-end:[php.example_code.bedrock.service] +// snippet-end:[php.example_code.bedrock.service] diff --git a/php/example_code/bedrock/GettingStartedWithBedrock.php b/php/example_code/bedrock/GettingStartedWithBedrock.php index e4e9bafc629..8d78bfdb563 100644 --- a/php/example_code/bedrock/GettingStartedWithBedrock.php +++ b/php/example_code/bedrock/GettingStartedWithBedrock.php @@ -1,6 +1,6 @@ 'us-east-1', - 'version' => 'latest', - 'profile' => 'default', - ]; - - $bedrockService = new BedrockService($clientArgs); - - echo "Let's retrieve the available foundation models (FMs).\n"; - - $result = $bedrockService->listFoundationModels(); - foreach ($result['modelSummaries'] as $model) { + $bedrockService = new BedrockService(); + echo "Let's retrieve the available foundation models...\n"; + $models = $bedrockService->listFoundationModels(); + foreach ($models as $model) { echo "\n==========================================\n"; echo " Model: {$model['modelId']}\n"; echo "------------------------------------------\n"; @@ -41,10 +31,10 @@ public function runExample() echo " Provider: {$model['providerName']}\n"; echo " Input modalities: " . json_encode($model['inputModalities']) . "\n"; echo " Output modalities: " . json_encode($model['outputModalities']) . "\n"; - echo " Supported customaizations: " . json_encode($model['customizationsSupported']) . "\n"; + echo " Supported customizations: " . json_encode($model['customizationsSupported']) . "\n"; echo " Supported inference types: " . json_encode($model['inferenceTypesSupported']) . "\n"; echo "==========================================\n"; } } } -# snippet-end:[php.example_code.bedrock.basics.scenario] +// snippet-end:[php.example_code.bedrock.basics.scenario] diff --git a/php/example_code/bedrock/README.md b/php/example_code/bedrock/README.md index 642e91acd48..7a1785d339e 100644 --- a/php/example_code/bedrock/README.md +++ b/php/example_code/bedrock/README.md @@ -40,7 +40,7 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `php` Code excerpts that show you how to call individual service functions. -- [ListFoundationModels](BedrockService.php#L31) +- [ListFoundationModels](BedrockService.php#L13) diff --git a/php/example_code/bedrock/composer.json b/php/example_code/bedrock/composer.json index b2afcd1fb38..29c9fe012e3 100644 --- a/php/example_code/bedrock/composer.json +++ b/php/example_code/bedrock/composer.json @@ -1,6 +1,6 @@ { "require": { - "aws/aws-sdk-php": "^3.286", + "aws/aws-sdk-php": "^3.321", "guzzlehttp/guzzle": "^7.8" }, "autoload": { diff --git a/php/example_code/bedrock/composer.lock b/php/example_code/bedrock/composer.lock index 664e7a1d30a..67036369eb2 100644 --- a/php/example_code/bedrock/composer.lock +++ b/php/example_code/bedrock/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "83f1fc7c0c3501e76eb99800da8cb537", + "content-hash": "1950437dbadb268c05d69582fbea5f0f", "packages": [ { "name": "aws/aws-crt-php", - "version": "v1.2.4", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2" + "reference": "a63485b65b6b3367039306496d49737cf1995408" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/eb0c6e4e142224a10b08f49ebf87f32611d162b2", - "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/a63485b65b6b3367039306496d49737cf1995408", + "reference": "a63485b65b6b3367039306496d49737cf1995408", "shasum": "" }, "require": { @@ -56,22 +56,22 @@ ], "support": { "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.4" + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.6" }, - "time": "2023-11-08T00:42:13+00:00" + "time": "2024-06-13T17:21:28+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.288.1", + "version": "3.321.9", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a1dfa12c7165de0b731ae8074c4ba1f3ae733f89" + "reference": "5de5099cfe0e17cb3eb2fe51de0101c99bc9442a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a1dfa12c7165de0b731ae8074c4ba1f3ae733f89", - "reference": "a1dfa12c7165de0b731ae8074c4ba1f3ae733f89", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5de5099cfe0e17cb3eb2fe51de0101c99bc9442a", + "reference": "5de5099cfe0e17cb3eb2fe51de0101c99bc9442a", "shasum": "" }, "require": { @@ -124,7 +124,10 @@ ], "psr-4": { "Aws\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/data/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -151,28 +154,28 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.288.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.321.9" }, - "time": "2023-11-22T19:35:38+00:00" + "time": "2024-09-11T18:15:49+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.8.1", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -183,9 +186,9 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -263,7 +266,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -279,20 +282,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:35:24+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", "shasum": "" }, "require": { @@ -300,7 +303,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -346,7 +349,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.2" + "source": "https://github.com/guzzle/promises/tree/2.0.3" }, "funding": [ { @@ -362,20 +365,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:19:20+00:00" + "time": "2024-07-18T10:29:17+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -390,8 +393,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -462,7 +465,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -478,20 +481,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "mtdowling/jmespath.php", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b" + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/bbb69a935c2cbb0c03d7f481a238027430f6440b", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", "shasum": "" }, "require": { @@ -508,7 +511,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -542,9 +545,9 @@ ], "support": { "issues": "https://github.com/jmespath/jmespath.php/issues", - "source": "https://github.com/jmespath/jmespath.php/tree/2.7.0" + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" }, - "time": "2023-08-25T10:54:48+00:00" + "time": "2024-09-04T18:46:31+00:00" }, { "name": "psr/http-client", @@ -600,20 +603,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -637,7 +640,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -649,9 +652,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -752,25 +755,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -799,7 +802,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" }, "funding": [ { @@ -815,24 +818,24 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -842,9 +845,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -882,7 +882,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -898,7 +898,7 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-09-09T11:45:10+00:00" } ], "packages-dev": [], diff --git a/php/example_code/bedrock/tests/BedrockBasicsTests.php b/php/example_code/bedrock/tests/BedrockBasicsTests.php index c7f9a305b11..47c296ace30 100644 --- a/php/example_code/bedrock/tests/BedrockBasicsTests.php +++ b/php/example_code/bedrock/tests/BedrockBasicsTests.php @@ -1,10 +1,10 @@ clientArgs = [ - 'region' => 'us-west-2', - 'version' => 'latest', - 'profile' => 'default', - ]; - $this->bedrockService = new BedrockService($this->clientArgs); - } - public function test_foundation_models_can_be_listed() { + $this->bedrockService = new BedrockService(); $result = $this->bedrockService->listFoundationModels(); - self::assertNotEmpty($result['modelSummaries']); + self::assertNotEmpty($result); } }