11<?php
2+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ // SPDX-License-Identifier: Apache-2.0
24
3- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4- # SPDX-License-Identifier: Apache-2.0
5-
6- #snippet-start:[php.example_code.bedrock-runtime.service]
7-
5+ // snippet-start:[php.example_code.bedrock-runtime.service]
86namespace BedrockRuntime ;
97
108use Aws \BedrockRuntime \BedrockRuntimeClient ;
@@ -21,17 +19,17 @@ public function __construct()
2119 ]);
2220 }
2321
24- # snippet-start:[php.example_code.bedrock-runtime.service.invokeClaude]
22+ // snippet-start:[php.example_code.bedrock-runtime.service.invokeClaude]
2523 public function invokeClaude ($ prompt )
2624 {
27- # The different model providers have individual request and response formats.
28- # For the format, ranges, and default values for Anthropic Claude, refer to:
29- # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html
25+ // The different model providers have individual request and response formats.
26+ // For the format, ranges, and default values for Anthropic Claude, refer to:
27+ // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html
3028
3129 $ completion = "" ;
3230 try {
3331 $ modelId = 'anthropic.claude-v2 ' ;
34- # Claude requires you to enclose the prompt as follows:
32+ // Claude requires you to enclose the prompt as follows:
3533 $ prompt = "\n\nHuman: {$ prompt }\n\nAssistant: " ;
3634 $ body = [
3735 'prompt ' => $ prompt ,
@@ -52,9 +50,9 @@ public function invokeClaude($prompt)
5250
5351 return $ completion ;
5452 }
55- # snippet-end:[php.example_code.bedrock-runtime.service.invokeClaude]
53+ // snippet-end:[php.example_code.bedrock-runtime.service.invokeClaude]
5654
57- # snippet-start:[php.example_code.bedrock-runtime.service.invokeJurassic2]
55+ // snippet-start:[php.example_code.bedrock-runtime.service.invokeJurassic2]
5856 public function invokeJurassic2 ($ prompt )
5957 {
6058 # The different model providers have individual request and response formats.
@@ -82,14 +80,14 @@ public function invokeJurassic2($prompt)
8280
8381 return $ completion ;
8482 }
85- # snippet-end:[php.example_code.bedrock-runtime.service.invokeJurassic2]
83+ // snippet-end:[php.example_code.bedrock-runtime.service.invokeJurassic2]
8684
87- # snippet-start:[php.example_code.bedrock-runtime.service.invokeLlama2]
85+ // snippet-start:[php.example_code.bedrock-runtime.service.invokeLlama2]
8886 public function invokeLlama2 ($ prompt )
8987 {
90- # The different model providers have individual request and response formats.
91- # For the format, ranges, and default values for Meta Llama 2 Chat, refer to:
92- # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html
88+ // The different model providers have individual request and response formats.
89+ // For the format, ranges, and default values for Meta Llama 2 Chat, refer to:
90+ // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html
9391
9492 $ completion = "" ;
9593 try {
@@ -112,14 +110,14 @@ public function invokeLlama2($prompt)
112110
113111 return $ completion ;
114112 }
115- # snippet-end:[php.example_code.bedrock-runtime.service.invokeLlama2]
113+ // snippet-end:[php.example_code.bedrock-runtime.service.invokeLlama2]
116114
117- # snippet-start:[php.example_code.bedrock-runtime.service.invokeStableDiffusion]
115+ // snippet-start:[php.example_code.bedrock-runtime.service.invokeStableDiffusion]
118116 public function invokeStableDiffusion (string $ prompt , int $ seed , string $ style_preset )
119117 {
120- # The different model providers have individual request and response formats.
121- # For the format, ranges, and available style_presets of Stable Diffusion models refer to:
122- # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html
118+ // The different model providers have individual request and response formats.
119+ // For the format, ranges, and available style_presets of Stable Diffusion models refer to:
120+ // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html
123121
124122 $ base64_image_data = "" ;
125123 try {
@@ -149,14 +147,14 @@ public function invokeStableDiffusion(string $prompt, int $seed, string $style_p
149147
150148 return $ base64_image_data ;
151149 }
152- # snippet-end:[php.example_code.bedrock-runtime.service.invokeStableDiffusion]
150+ // snippet-end:[php.example_code.bedrock-runtime.service.invokeStableDiffusion]
153151
154- # snippet-start:[php.example_code.bedrock-runtime.service.invokeTitanImage]
152+ // snippet-start:[php.example_code.bedrock-runtime.service.invokeTitanImage]
155153 public function invokeTitanImage (string $ prompt , int $ seed )
156154 {
157- # The different model providers have individual request and response formats.
158- # For the format, ranges, and default values for Titan Image models refer to:
159- # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-image.html
155+ // The different model providers have individual request and response formats.
156+ // For the format, ranges, and default values for Titan Image models refer to:
157+ // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-image.html
160158
161159 $ base64_image_data = "" ;
162160 try {
@@ -188,7 +186,6 @@ public function invokeTitanImage(string $prompt, int $seed)
188186
189187 return $ base64_image_data ;
190188 }
191- # snippet-end:[php.example_code.bedrock-runtime.service.invokeTitanImage]
189+ // snippet-end:[php.example_code.bedrock-runtime.service.invokeTitanImage]
192190}
193-
194- #snippet-end:[php.example_code.bedrock-runtime.service]
191+ // snippet-end:[php.example_code.bedrock-runtime.service]
0 commit comments