AWS code-library documentation change
Summary
Removed all documentation and code examples related to AI21 Labs Jurassic-2 model integration
Security assessment
The changes remove references to a specific model provider but contain no security advisories, vulnerability disclosures, or authentication changes. This appears to be routine documentation pruning rather than addressing security issues.
Diff
diff --git a/code-library/latest/ug/csharp_4_bedrock-runtime_code_examples.md b/code-library/latest/ug/csharp_4_bedrock-runtime_code_examples.md index a6531aff1..f7c749f00 100644 --- a//code-library/latest/ug/csharp_4_bedrock-runtime_code_examples.md +++ b//code-library/latest/ug/csharp_4_bedrock-runtime_code_examples.md @@ -5 +5 @@ -AI21 Labs Jurassic-2Amazon Titan TextAnthropic ClaudeCohere CommandMeta LlamaMistral AI +Amazon Titan TextAnthropic ClaudeCohere CommandMeta LlamaMistral AI @@ -17,2 +16,0 @@ Each example includes a link to the complete source code, where you can find ins - * AI21 Labs Jurassic-2 - @@ -32,147 +29,0 @@ Each example includes a link to the complete source code, where you can find ins -## AI21 Labs Jurassic-2 - -The following code example shows how to send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API. - -**SDK for .NET (v4)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv4/Bedrock-runtime#code-examples). - -Send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API. - - - // Use the Converse API to send a text message to AI21 Labs Jurassic-2. - - using System; - using System.Collections.Generic; - using Amazon; - using Amazon.BedrockRuntime; - using Amazon.BedrockRuntime.Model; - - // Create a Bedrock Runtime client in the AWS Region you want to use. - var client = new AmazonBedrockRuntimeClient(RegionEndpoint.USEast1); - - // Set the model ID, e.g., Jurassic-2 Mid. - var modelId = "ai21.j2-mid-v1"; - - // Define the user message. - var userMessage = "Describe the purpose of a 'hello world' program in one line."; - - // Create a request with the model ID, the user message, and an inference configuration. - var request = new ConverseRequest - { - ModelId = modelId, - Messages = new List<Message> - { - new Message - { - Role = ConversationRole.User, - Content = new List<ContentBlock> { new ContentBlock { Text = userMessage } } - } - }, - InferenceConfig = new InferenceConfiguration() - { - MaxTokens = 512, - Temperature = 0.5F, - TopP = 0.9F - } - }; - - try - { - // Send the request to the Bedrock Runtime and wait for the result. - var response = await client.ConverseAsync(request); - - // Extract and print the response text. - string responseText = response?.Output?.Message?.Content?[0]?.Text ?? ""; - Console.WriteLine(responseText); - } - catch (AmazonBedrockRuntimeException e) - { - Console.WriteLine($"ERROR: Can't invoke '{modelId}'. Reason: {e.Message}"); - throw; - } - - - - - * For API details, see [Converse](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-runtime-2023-09-30/Converse) in _AWS SDK for .NET API Reference_. - - - - -The following code example shows how to send a text message to AI21 Labs Jurassic-2, using the Invoke Model API. - -**SDK for .NET (v4)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv4/Bedrock-runtime#code-examples). - -Use the Invoke Model API to send a text message. - - - // Use the native inference API to send a text message to AI21 Labs Jurassic-2. - - using System; - using System.IO; - using System.Text.Json; - using System.Text.Json.Nodes; - using Amazon; - using Amazon.BedrockRuntime; - using Amazon.BedrockRuntime.Model; - - // Create a Bedrock Runtime client in the AWS Region you want to use. - var client = new AmazonBedrockRuntimeClient(RegionEndpoint.USEast1); - - // Set the model ID, e.g., Jurassic-2 Mid. - var modelId = "ai21.j2-mid-v1"; - - // Define the user message. - var userMessage = "Describe the purpose of a 'hello world' program in one line."; - - //Format the request payload using the model's native structure. - var nativeRequest = JsonSerializer.Serialize(new - { - prompt = userMessage, - maxTokens = 512, - temperature = 0.5 - }); - - // Create a request with the model ID and the model's native request payload. - var request = new InvokeModelRequest() - { - ModelId = modelId, - Body = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(nativeRequest)), - ContentType = "application/json" - }; - - try - { - // Send the request to the Bedrock Runtime and wait for the response. - var response = await client.InvokeModelAsync(request); - - // Decode the response body. - var modelResponse = await JsonNode.ParseAsync(response.Body); - - // Extract and print the response text. - var responseText = modelResponse["completions"]?[0]?["data"]?["text"] ?? ""; - Console.WriteLine(responseText); - } - catch (AmazonBedrockRuntimeException e) - { - Console.WriteLine($"ERROR: Can't invoke '{modelId}'. Reason: {e.Message}"); - throw; - } - - - - - * For API details, see [InvokeModel](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-runtime-2023-09-30/InvokeModel) in _AWS SDK for .NET API Reference_. - - - -