AWS nova documentation change
Summary
Added Go SDK V2 code example for sending messages to Amazon Nova using Bedrock's Converse API
Security assessment
Standard code sample addition showing API usage. Contains no security-specific handling (e.g., authentication, encryption) or references to security features/vulnerabilities.
Diff
diff --git a/nova/latest/userguide/code-examples-converse.md b/nova/latest/userguide/code-examples-converse.md index 9a3be517c..fa3fa885f 100644 --- a//nova/latest/userguide/code-examples-converse.md +++ b//nova/latest/userguide/code-examples-converse.md @@ -159,0 +160,45 @@ Send a conversation of messages to Amazon Nova using Bedrock's Converse API with +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). + +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_. + + + +