AWS code-library documentation change
Summary
Added 'Amazon Nova' section with Go SDK V2 code example for Bedrock's Converse API
Security assessment
This adds documentation for a new model (Amazon Nova) in the existing code examples page. The change introduces standard API usage patterns without addressing security vulnerabilities, security configurations, or security features. No security-specific content is present.
Diff
diff --git a/code-library/latest/ug/go_2_bedrock-runtime_code_examples.md b/code-library/latest/ug/go_2_bedrock-runtime_code_examples.md index 9a28b76ba..320432084 100644 --- a//code-library/latest/ug/go_2_bedrock-runtime_code_examples.md +++ b//code-library/latest/ug/go_2_bedrock-runtime_code_examples.md @@ -7 +7 @@ -Get startedScenariosAmazon Titan Image GeneratorAnthropic Claude +Get startedScenariosAmazon NovaAmazon Titan Image GeneratorAnthropic Claude @@ -24,0 +25,2 @@ Each example includes a link to the complete source code, where you can find ins + * Amazon Nova + @@ -287,0 +290,46 @@ Invoke multiple foundation models on Amazon Bedrock. +## Amazon Nova + +The following code example shows how to send a text message to Amazon Nova, using Bedrock's Converse API. + +**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). + +Send a text message to Amazon Nova, using Bedrock's Converse API. + + + func (wrapper ConverseWrapper) ConverseNova(ctx context.Context, prompt string) (string, error) { + var content = types.ContentBlockMemberText{ + Value: prompt, + } + var message = types.Message{ + Content: []types.ContentBlock{&content}, + Role: "user", + } + modelId := "amazon.nova-lite-v1:0" + var converseInput = bedrockruntime.ConverseInput{ + ModelId: aws.String(modelId), + Messages: []types.Message{message}, + } + response, err := wrapper.BedrockRuntimeClient.Converse(ctx, &converseInput) + if err != nil { + ProcessError(err, modelId) + } + + responseText, _ := response.Output.(*types.ConverseOutputMemberMessage) + responseContentBlock := responseText.Value.Content[0] + text, _ := responseContentBlock.(*types.ContentBlockMemberText) + return text.Value, nil + } + + + + + * For API details, see [Converse](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/bedrockruntime#Client.Converse) in _AWS SDK for Go API Reference_. + + + +