AWS Security ChangesHomeSearch

AWS bedrock documentation change

Service: bedrock · 2025-10-10 · Documentation low

File: bedrock/latest/userguide/bedrock-runtime_example_bedrock-runtime_InvokeModel_TitanText_section.md

Summary

Removed detailed code examples for multiple SDKs and simplified documentation to a single example format

Security assessment

The changes remove implementation details but contain no security-related content. No security vulnerabilities, authentication mechanisms, or access controls are mentioned. The modifications appear focused on simplifying documentation structure rather than addressing security concerns.

Diff

diff --git a/bedrock/latest/userguide/bedrock-runtime_example_bedrock-runtime_InvokeModel_TitanText_section.md b/bedrock/latest/userguide/bedrock-runtime_example_bedrock-runtime_InvokeModel_TitanText_section.md
index 0387d07d5..999022a76 100644
--- a//bedrock/latest/userguide/bedrock-runtime_example_bedrock-runtime_InvokeModel_TitanText_section.md
+++ b//bedrock/latest/userguide/bedrock-runtime_example_bedrock-runtime_InvokeModel_TitanText_section.md
@@ -7,447 +7 @@
-The following code examples show how to send a text message to Amazon Titan Text, using the Invoke Model API.
-
-.NET
-    
-
-**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 Amazon Titan Text.
-    
-    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., Titan Text Premier.
-    var modelId = "amazon.titan-text-premier-v1:0";
-    
-    // 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
-    {
-        inputText = userMessage,
-        textGenerationConfig = new
-        {
-            maxTokenCount = 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["results"]?[0]?["outputText"] ?? "";
-        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_. 
-
-
-
-
-Go
-    
-
-**SDK for Go V2**
-    
-
-###### 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/gov2/bedrock-runtime#code-examples). 
-
-Use the Invoke Model API to send a text message.
-    
-    
-    import (
-    	"context"
-    	"encoding/json"
-    	"log"
-    	"strings"
-    
-    	"github.com/aws/aws-sdk-go-v2/aws"
-    	"github.com/aws/aws-sdk-go-v2/service/bedrockruntime"
-    )
-    
-    // InvokeModelWrapper encapsulates Amazon Bedrock actions used in the examples.
-    // It contains a Bedrock Runtime client that is used to invoke foundation models.
-    type InvokeModelWrapper struct {
-    	BedrockRuntimeClient *bedrockruntime.Client
-    }
-    
-    
-    
-    // Each model provider has their own individual request and response formats.
-    // For the format, ranges, and default values for Amazon Titan Text, refer to:
-    // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-text.html
-    type TitanTextRequest struct {
-    	InputText            string               `json:"inputText"`
-    	TextGenerationConfig TextGenerationConfig `json:"textGenerationConfig"`
-    }
-    
-    type TextGenerationConfig struct {
-    	Temperature   float64  `json:"temperature"`
-    	TopP          float64  `json:"topP"`
-    	MaxTokenCount int      `json:"maxTokenCount"`
-    	StopSequences []string `json:"stopSequences,omitempty"`
-    }
-    
-    type TitanTextResponse struct {
-    	InputTextTokenCount int      `json:"inputTextTokenCount"`
-    	Results             []Result `json:"results"`
-    }
-    
-    type Result struct {
-    	TokenCount       int    `json:"tokenCount"`
-    	OutputText       string `json:"outputText"`
-    	CompletionReason string `json:"completionReason"`
-    }
-    
-    func (wrapper InvokeModelWrapper) InvokeTitanText(ctx context.Context, prompt string) (string, error) {
-    	modelId := "amazon.titan-text-express-v1"
-    
-    	body, err := json.Marshal(TitanTextRequest{
-    		InputText: prompt,
-    		TextGenerationConfig: TextGenerationConfig{
-    			Temperature:   0,
-    			TopP:          1,
-    			MaxTokenCount: 4096,
-    		},
-    	})
-    
-    	if err != nil {
-    		log.Fatal("failed to marshal", err)
-    	}
-    
-    	output, err := wrapper.BedrockRuntimeClient.InvokeModel(ctx, &bedrockruntime.InvokeModelInput{
-    		ModelId:     aws.String(modelId),
-    		ContentType: aws.String("application/json"),
-    		Body:        body,
-    	})
-    
-    	if err != nil {
-    		ProcessError(err, modelId)
-    	}
-    
-    	var response TitanTextResponse
-    	if err := json.Unmarshal(output.Body, &response); err != nil {
-    		log.Fatal("failed to unmarshal", err)
-    	}
-    
-    	return response.Results[0].OutputText, nil
-    }
-    
-    
-    
-
-  * For API details, see [InvokeModel](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/bedrockruntime#Client.InvokeModel) in _AWS SDK for Go API Reference_. 
-
-
-
-
-Java
-    
-
-**SDK for Java 2.x**
-    
-
-###### 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/javav2/example_code/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 Amazon Titan Text.
-    
-    import org.json.JSONObject;
-    import org.json.JSONPointer;