From 4b0bd9ad68cee7f4404f99430997f5f393ba9708 Mon Sep 17 00:00:00 2001 From: Dennis Traub Date: Mon, 5 Feb 2024 21:53:59 +0100 Subject: [PATCH] Bedrock Runtime: Replace documentation links (#6040) * Switch documentation links for Claude, Jurassic-2, and Stable Diffusion to docs.aws.amazon.com/... --- gov2/bedrock-runtime/actions/invoke_model.go | 4 ++-- .../example_code/bedrock-runtime/actions/invoke-claude.js | 2 +- .../bedrock-runtime/actions/invoke-jurassic2.js | 2 +- .../main/java/com/example/bedrockruntime/InvokeModel.java | 6 +++--- .../java/com/example/bedrockruntime/InvokeModelAsync.java | 8 ++++---- .../bedrock-runtime/BedrockRuntimeService.php | 6 +++--- .../bedrock-runtime/bedrock_runtime_wrapper.py | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/gov2/bedrock-runtime/actions/invoke_model.go b/gov2/bedrock-runtime/actions/invoke_model.go index 1726c8b20c7..4b267b34f81 100644 --- a/gov2/bedrock-runtime/actions/invoke_model.go +++ b/gov2/bedrock-runtime/actions/invoke_model.go @@ -28,7 +28,7 @@ type InvokeModelWrapper struct { // Each model provider has their own individual request and response formats. // For the format, ranges, and default values for Anthropic Claude, refer to: -// https://docs.anthropic.com/claude/reference/complete_post +// https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html type ClaudeRequest struct { Prompt string `json:"prompt"` @@ -79,7 +79,7 @@ func (wrapper InvokeModelWrapper) InvokeClaude(prompt string) (string, error) { // Each model provider has their own individual request and response formats. // For the format, ranges, and default values for AI21 Labs Jurassic-2, refer to: -// https://docs.ai21.com/reference/j2-complete-ref +// https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-jurassic2.html type Jurassic2Request struct { Prompt string `json:"prompt"` diff --git a/javascriptv3/example_code/bedrock-runtime/actions/invoke-claude.js b/javascriptv3/example_code/bedrock-runtime/actions/invoke-claude.js index 181ea726a7b..3403dc0f59c 100644 --- a/javascriptv3/example_code/bedrock-runtime/actions/invoke-claude.js +++ b/javascriptv3/example_code/bedrock-runtime/actions/invoke-claude.js @@ -27,7 +27,7 @@ export const invokeClaude = async (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.anthropic.com/claude/reference/complete_post + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html */ const payload = { prompt: enclosedPrompt, diff --git a/javascriptv3/example_code/bedrock-runtime/actions/invoke-jurassic2.js b/javascriptv3/example_code/bedrock-runtime/actions/invoke-jurassic2.js index 9c1f59fe1d3..6e4f498c84d 100644 --- a/javascriptv3/example_code/bedrock-runtime/actions/invoke-jurassic2.js +++ b/javascriptv3/example_code/bedrock-runtime/actions/invoke-jurassic2.js @@ -30,7 +30,7 @@ export const invokeJurassic2 = async (prompt) => { /* The different model providers have individual request and response formats. * For the format, ranges, and default values for AI21 Labs Jurassic-2, refer to: - * https://docs.ai21.com/reference/j2-complete-ref + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-jurassic2.html */ const payload = { prompt, diff --git a/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModel.java b/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModel.java index 346b3e593c3..c65c1d85f81 100644 --- a/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModel.java +++ b/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModel.java @@ -39,7 +39,7 @@ public static String invokeClaude(String 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.anthropic.com/claude/reference/complete_post + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html */ String claudeModelId = "anthropic.claude-v2"; @@ -89,7 +89,7 @@ public static String invokeJurassic2(String prompt) { * The different model providers have individual request and response formats. * For the format, ranges, and default values for AI21 Labs Jurassic-2, refer * to: - * https://docs.ai21.com/reference/j2-complete-ref + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-jurassic2.html */ String jurassic2ModelId = "ai21.j2-mid-v1"; @@ -190,7 +190,7 @@ public static String invokeStableDiffusion(String prompt, long seed, String styl * 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://platform.stability.ai/docs/api-reference#tag/v1generation + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html */ String stableDiffusionModelId = "stability.stable-diffusion-xl"; diff --git a/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModelAsync.java b/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModelAsync.java index eabe1ebbe89..aff36b6e412 100644 --- a/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModelAsync.java +++ b/javav2/example_code/bedrock-runtime/src/main/java/com/example/bedrockruntime/InvokeModelAsync.java @@ -4,13 +4,13 @@ package com.example.bedrockruntime; // snippet-start:[bedrock-runtime.java2.invoke_model_async.import] + import org.json.JSONArray; import org.json.JSONObject; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.core.SdkBytes; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.bedrockruntime.BedrockRuntimeAsyncClient; -import software.amazon.awssdk.services.bedrockruntime.BedrockRuntimeClient; import software.amazon.awssdk.services.bedrockruntime.model.InvokeModelRequest; import software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse; @@ -41,7 +41,7 @@ public static String invokeClaude(String 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.anthropic.com/claude/reference/complete_post + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html */ String claudeModelId = "anthropic.claude-v2"; @@ -103,7 +103,7 @@ public static String invokeJurassic2(String 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.anthropic.com/claude/reference/complete_post + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html */ String jurassic2ModelId = "ai21.j2-mid-v1"; @@ -232,7 +232,7 @@ public static String invokeStableDiffusion(String prompt, long seed, String styl * 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://platform.stability.ai/docs/api-reference#tag/v1generation + * https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html */ String stableDiffusionModelId = "stability.stable-diffusion-xl"; diff --git a/php/example_code/bedrock-runtime/BedrockRuntimeService.php b/php/example_code/bedrock-runtime/BedrockRuntimeService.php index 9033d56c519..01182939f5b 100644 --- a/php/example_code/bedrock-runtime/BedrockRuntimeService.php +++ b/php/example_code/bedrock-runtime/BedrockRuntimeService.php @@ -35,7 +35,7 @@ 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.anthropic.com/claude/reference/complete_post + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html $completion = ""; @@ -74,7 +74,7 @@ public function invokeJurassic2($prompt) { # The different model providers have individual request and response formats. # For the format, ranges, and default values for AI21 Labs Jurassic-2, refer to: - # https://docs.ai21.com/reference/j2-complete-ref + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-jurassic2.html $completion = ""; @@ -144,7 +144,7 @@ public function invokeStableDiffusion(string $prompt, int $seed, string $style_p { # 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://platform.stability.ai/docs/api-reference#tag/v1generation + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html $base64_image_data = ""; diff --git a/python/example_code/bedrock-runtime/bedrock_runtime_wrapper.py b/python/example_code/bedrock-runtime/bedrock_runtime_wrapper.py index 501cb4afbd7..72a6cfa1297 100644 --- a/python/example_code/bedrock-runtime/bedrock_runtime_wrapper.py +++ b/python/example_code/bedrock-runtime/bedrock_runtime_wrapper.py @@ -49,7 +49,7 @@ def invoke_claude(self, prompt): try: # The different model providers have individual request and response formats. # For the format, ranges, and default values for Anthropic Claude, refer to: - # https://docs.anthropic.com/claude/reference/complete_post + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html # Claude requires you to enclose the prompt as follows: enclosed_prompt = "Human: " + prompt + "\n\nAssistant:" @@ -89,7 +89,7 @@ def invoke_jurassic2(self, prompt): try: # The different model providers have individual request and response formats. # For the format, ranges, and default values for AI21 Labs Jurassic-2, refer to: - # https://docs.ai21.com/reference/j2-complete-ref + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-jurassic2.html body = { "prompt": prompt, @@ -165,7 +165,7 @@ def invoke_stable_diffusion(self, prompt, seed, style_preset=None): try: # 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://platform.stability.ai/docs/api-reference#tag/v1generation + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-stability-diffusion.html body = { "text_prompts": [{"text": prompt}], @@ -249,7 +249,7 @@ async def invoke_model_with_response_stream(self, prompt): try: # The different model providers have individual request and response formats. # For the format, ranges, and default values for Anthropic Claude, refer to: - # https://docs.anthropic.com/claude/reference/complete_post + # https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html # Claude requires you to enclose the prompt as follows: enclosed_prompt = "Human: " + prompt + "\n\nAssistant:"