diff --git a/.doc_gen/metadata/bedrock-runtime_metadata.yaml b/.doc_gen/metadata/bedrock-runtime_metadata.yaml
index 2e8de4e4b5e..98b0790e1bc 100644
--- a/.doc_gen/metadata/bedrock-runtime_metadata.yaml
+++ b/.doc_gen/metadata/bedrock-runtime_metadata.yaml
@@ -100,6 +100,22 @@ bedrock-runtime_Converse_AmazonNovaText:
- description: Send a text message to Amazon Nova, using Bedrock's Converse API.
snippet_tags:
- bedrock-runtime.java2.Converse_AmazonNovaText
+ .NET:
+ versions:
+ - sdk_version: 3
+ github: dotnetv3/Bedrock-runtime
+ excerpts:
+ - description: Send a text message to Amazon Nova, using Bedrock's Converse API.
+ snippet_tags:
+ - BedrockRuntime.dotnetv3.Converse_AmazonNovaText
+ Python:
+ versions:
+ - sdk_version: 3
+ github: python/example_code/bedrock-runtime
+ excerpts:
+ - description: Send a text message to Amazon Nova, using Bedrock's Converse API.
+ snippet_tags:
+ - python.example_code.bedrock-runtime.Converse_AmazonNovaText
services:
bedrock-runtime: {Converse}
@@ -349,6 +365,22 @@ bedrock-runtime_ConverseStream_AmazonNovaText:
- description: Send a text message to Amazon Nova using Bedrock's Converse API and process the response stream in real-time.
snippet_tags:
- bedrock-runtime.java2.ConverseStream_AmazonNovaText
+ .NET:
+ versions:
+ - sdk_version: 3
+ github: dotnetv3/Bedrock-runtime
+ excerpts:
+ - description: Send a text message to Amazon Nova, using Bedrock's Converse API and process the response stream in real-time.
+ snippet_tags:
+ - BedrockRuntime.dotnetv3.ConverseStream_AmazonNovaText
+ Python:
+ versions:
+ - sdk_version: 3
+ github: python/example_code/bedrock-runtime
+ excerpts:
+ - description: Send a text message to Amazon Nova, using Bedrock's Converse API and process the response stream in real-time.
+ snippet_tags:
+ - python.example_code.bedrock-runtime.ConverseStream_AmazonNovaText
services:
bedrock-runtime: {ConverseStream}
@@ -1137,6 +1169,22 @@ bedrock-runtime_InvokeModel_AmazonNovaImageGeneration:
- description: Create an image with Amazon Nova Canvas.
snippet_tags:
- bedrock-runtime.java2.InvokeModel_AmazonNovaImageGeneration
+ .NET:
+ versions:
+ - sdk_version: 3
+ github: dotnetv3/Bedrock-runtime
+ excerpts:
+ - description: Create an image with Amazon Nova Canvas.
+ snippet_tags:
+ - BedrockRuntime.dotnetv3.InvokeModel_AmazonNovaImageGeneration
+ Python:
+ versions:
+ - sdk_version: 3
+ github: python/example_code/bedrock-runtime
+ excerpts:
+ - description: Create an image with the Amazon Nova Canvas.
+ snippet_tags:
+ - python.example_code.bedrock-runtime.InvokeModel_AmazonNovaImageGeneration
services:
bedrock-runtime: {InvokeModel}
diff --git a/dotnetv3/Bedrock-runtime/.gitignore b/dotnetv3/Bedrock-runtime/.gitignore
index ba964e2a8e7..98ae3975334 100644
--- a/dotnetv3/Bedrock-runtime/.gitignore
+++ b/dotnetv3/Bedrock-runtime/.gitignore
@@ -1,2 +1,3 @@
/.vs/
/Tools/
+**/generated-images/
diff --git a/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln b/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln
index f495e60e9b1..d9e5d12e854 100644
--- a/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln
+++ b/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln
@@ -94,6 +94,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModelWithResponseStre
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModelWithResponseStream", "Models\AnthropicClaude\InvokeModelWithResponseStream\InvokeModelWithResponseStream.csproj", "{C75F2BBE-7C84-4B01-9836-7279DAE41499}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AmazonNovaText", "AmazonNovaText", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AmazonNova", "AmazonNova", "{3AF63EC9-2EB0-4A0B-8C3B-0CA3595080F6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Converse", "Models\AmazonNova\AmazonNovaText\Converse\Converse.csproj", "{2E4C9BFE-C49C-0567-D73C-F2915AB62CA6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConverseStream", "Models\AmazonNova\AmazonNovaText\ConverseStream\ConverseStream.csproj", "{E144492A-337A-0755-EAB4-DA083C3A2DDB}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AmazonNovaCanvas", "AmazonNovaCanvas", "{4D3E429C-CCAE-42DE-A062-4717E71D8403}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InvokeModel", "Models\AmazonNova\AmazonNovaCanvas\InvokeModel\InvokeModel.csproj", "{2B39D4E2-C6B6-4340-A9AD-5F5C25CA8C1D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -200,6 +212,18 @@ Global
{C75F2BBE-7C84-4B01-9836-7279DAE41499}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C75F2BBE-7C84-4B01-9836-7279DAE41499}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C75F2BBE-7C84-4B01-9836-7279DAE41499}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2E4C9BFE-C49C-0567-D73C-F2915AB62CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2E4C9BFE-C49C-0567-D73C-F2915AB62CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2E4C9BFE-C49C-0567-D73C-F2915AB62CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2E4C9BFE-C49C-0567-D73C-F2915AB62CA6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E144492A-337A-0755-EAB4-DA083C3A2DDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E144492A-337A-0755-EAB4-DA083C3A2DDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E144492A-337A-0755-EAB4-DA083C3A2DDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E144492A-337A-0755-EAB4-DA083C3A2DDB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2B39D4E2-C6B6-4340-A9AD-5F5C25CA8C1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2B39D4E2-C6B6-4340-A9AD-5F5C25CA8C1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2B39D4E2-C6B6-4340-A9AD-5F5C25CA8C1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2B39D4E2-C6B6-4340-A9AD-5F5C25CA8C1D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -227,6 +251,7 @@ Global
{3D6441FC-0FE8-4D0C-910D-3D9310599C71} = {3F96ECB4-1644-43E8-8643-2CDCF9E679F1}
{D1B0719F-4F84-4DBC-BCAD-E856FB3193D7} = {8BAC2322-AD3C-484A-B51D-8263BC4E6646}
{1E62D4FB-CC59-4F1E-BB22-574CEC08C94B} = {BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B}
+ {B753CEB9-EA53-4AE1-997E-B7D54A299D58} = {65504C76-7E32-4A12-A42E-BCDA4FE79BC1}
{2A6989CB-B273-4841-BD3E-7B1BBA4DD25F} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C}
{BCC66C37-4980-484F-819D-066D2FF2669C} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C}
{52CDA3F4-F090-4224-978A-5F42388DCF92} = {3F96ECB4-1644-43E8-8643-2CDCF9E679F1}
@@ -235,6 +260,12 @@ Global
{4B5A00D6-B9F1-449F-A9D2-80E860D6BD75} = {65504C76-7E32-4A12-A42E-BCDA4FE79BC1}
{EFC7D088-EF45-464B-97CD-0BBA486B224A} = {BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B}
{C75F2BBE-7C84-4B01-9836-7279DAE41499} = {8BAC2322-AD3C-484A-B51D-8263BC4E6646}
+ {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {3AF63EC9-2EB0-4A0B-8C3B-0CA3595080F6}
+ {3AF63EC9-2EB0-4A0B-8C3B-0CA3595080F6} = {41B69207-8F29-41BC-9114-78EE740485C8}
+ {2E4C9BFE-C49C-0567-D73C-F2915AB62CA6} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
+ {E144492A-337A-0755-EAB4-DA083C3A2DDB} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
+ {4D3E429C-CCAE-42DE-A062-4717E71D8403} = {3AF63EC9-2EB0-4A0B-8C3B-0CA3595080F6}
+ {2B39D4E2-C6B6-4340-A9AD-5F5C25CA8C1D} = {4D3E429C-CCAE-42DE-A062-4717E71D8403}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E48A5088-1BBB-4A8B-9AB2-CC5CE0482466}
diff --git a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj
index 8475494e76e..c26f412667b 100644
--- a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj
index bf2403af903..986018da574 100644
--- a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.cs b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.cs
new file mode 100644
index 00000000000..6db2f957aef
--- /dev/null
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.cs
@@ -0,0 +1,128 @@
+// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+// SPDX-License-Identifier: Apache-2.0
+
+// snippet-start:[BedrockRuntime.dotnetv3.InvokeModel_AmazonNovaImageGeneration]
+// Use the native inference API to create an image with Amazon Nova Canvas.
+
+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.
+var modelId = "amazon.nova-canvas-v1:0";
+
+// Define the image generation prompt for the model.
+var prompt = "A stylized picture of a cute old steampunk robot.";
+
+// Create a random seed between 0 and 858,993,459
+int seed = new Random().Next(0, 858993460);
+
+//Format the request payload using the model's native structure.
+var nativeRequest = JsonSerializer.Serialize(new
+{
+ taskType = "TEXT_IMAGE",
+ textToImageParams = new
+ {
+ text = prompt
+ },
+ imageGenerationConfig = new
+ {
+ seed,
+ quality = "standard",
+ width = 512,
+ height = 512,
+ numberOfImages = 1
+ }
+});
+
+// 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 the image data.
+ var base64Image = modelResponse["images"]?[0].ToString() ?? "";
+
+ // Save the image in a local folder
+ string savedPath = AmazonNovaCanvas.InvokeModel.SaveBase64Image(base64Image);
+ Console.WriteLine($"Image saved to: {savedPath}");
+}
+catch (AmazonBedrockRuntimeException e)
+{
+ Console.WriteLine($"ERROR: Can't invoke '{modelId}'. Reason: {e.Message}");
+ throw;
+}
+
+// snippet-end:[BedrockRuntime.dotnetv3.InvokeModel_AmazonNovaImageGeneration]
+
+// Create a partial class to make the top-level script testable.
+namespace AmazonNovaCanvas
+{
+ public partial class InvokeModel
+ {
+ public static string SaveBase64Image(string base64String, string outputFolderName = "generated-images")
+ {
+ // Get the directory where the script is located
+ string scriptDirectory = AppDomain.CurrentDomain.BaseDirectory;
+
+ // Navigate to the script's folder
+ if (scriptDirectory.Contains("bin"))
+ {
+ scriptDirectory = Directory.GetParent(scriptDirectory)?.Parent?.Parent?.Parent?.FullName
+ ?? throw new DirectoryNotFoundException("Could not find script directory");
+ }
+
+ // Combine script directory with output folder
+ string outputPath = Path.Combine(scriptDirectory, outputFolderName);
+
+ // Create directory if it doesn't exist
+ if (!Directory.Exists(outputPath))
+ {
+ Directory.CreateDirectory(outputPath);
+ }
+
+ // Remove base64 header if present (e.g., "data:image/jpeg;base64,")
+ string base64Data = base64String;
+ if (base64String.Contains(","))
+ {
+ base64Data = base64String.Split(',')[1];
+ }
+
+ // Convert base64 to bytes
+ byte[] imageBytes = Convert.FromBase64String(base64Data);
+
+ // Find the next available number
+ int fileNumber = 1;
+ string filePath;
+ do
+ {
+ string paddedNumber = fileNumber.ToString("D2"); // Pads with leading zero
+ filePath = Path.Combine(outputPath, $"image_{paddedNumber}.jpg");
+ fileNumber++;
+ } while (File.Exists(filePath));
+
+ // Save the image
+ File.WriteAllBytes(filePath, imageBytes);
+
+ return filePath;
+ }
+ }
+}
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.csproj
new file mode 100644
index 00000000000..0db5411af0b
--- /dev/null
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.csproj
@@ -0,0 +1,12 @@
+
+
+ Exe
+ net8.0
+ AmazonNovaCanvas.$(MSBuildProjectName)
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/Converse/Converse.cs b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/Converse/Converse.cs
new file mode 100644
index 00000000000..46466fec1d2
--- /dev/null
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/Converse/Converse.cs
@@ -0,0 +1,60 @@
+// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+// SPDX-License-Identifier: Apache-2.0
+
+// snippet-start:[BedrockRuntime.dotnetv3.Converse_AmazonNovaText]
+// Use the Converse API to send a text message to Amazon Nova.
+
+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., Amazon Nova Lite.
+var modelId = "amazon.nova-lite-v1:0";
+
+// 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
+ {
+ new Message
+ {
+ Role = ConversationRole.User,
+ Content = new List { 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;
+}
+
+// snippet-end:[BedrockRuntime.dotnetv3.Converse_AmazonNovaText]
+
+// Create a partial class to make the top-level script testable.
+namespace AmazonNovaText { public partial class Converse { } }
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/Converse/Converse.csproj
new file mode 100644
index 00000000000..5fa769392db
--- /dev/null
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/Converse/Converse.csproj
@@ -0,0 +1,12 @@
+
+
+ Exe
+ net8.0
+ AmazonNovaText.$(MSBuildProjectName)
+
+
+
+
+
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.cs b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.cs
new file mode 100644
index 00000000000..69ff7825dd9
--- /dev/null
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.cs
@@ -0,0 +1,67 @@
+// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+// SPDX-License-Identifier: Apache-2.0
+
+// snippet-start:[BedrockRuntime.dotnetv3.ConverseStream_AmazonNovaText]
+// Use the Converse API to send a text message to Amazon Nova
+// and print the response stream.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+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., Amazon Nova Lite.
+var modelId = "amazon.nova-lite-v1:0";
+
+// 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 ConverseStreamRequest
+{
+ ModelId = modelId,
+ Messages = new List
+ {
+ new Message
+ {
+ Role = ConversationRole.User,
+ Content = new List { 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.ConverseStreamAsync(request);
+
+ // Extract and print the streamed response text in real-time.
+ foreach (var chunk in response.Stream.AsEnumerable())
+ {
+ if (chunk is ContentBlockDeltaEvent)
+ {
+ Console.Write((chunk as ContentBlockDeltaEvent).Delta.Text);
+ }
+ }
+}
+catch (AmazonBedrockRuntimeException e)
+{
+ Console.WriteLine($"ERROR: Can't invoke '{modelId}'. Reason: {e.Message}");
+ throw;
+}
+
+// snippet-end:[BedrockRuntime.dotnetv3.ConverseStream_AmazonNovaText]
+
+// Create a partial class to make the top-level script testable.
+namespace AmazonNovaText { public partial class ConverseStream { } }
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.csproj
new file mode 100644
index 00000000000..1260dc1d435
--- /dev/null
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.csproj
@@ -0,0 +1,12 @@
+
+
+ Exe
+ net8.0
+ AmazonNovaText.$(MSBuildProjectName)
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/Converse/Converse.csproj
index e505af96607..3651f4be200 100644
--- a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/Converse/Converse.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/Converse/Converse.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/ConverseStream/ConverseStream.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/ConverseStream/ConverseStream.csproj
index 5752f31c880..662bf35f3e1 100644
--- a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/ConverseStream/ConverseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/ConverseStream/ConverseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModel/InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModel/InvokeModel.csproj
index 5752f31c880..662bf35f3e1 100644
--- a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModel/InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModel/InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
index 5752f31c880..662bf35f3e1 100644
--- a/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AmazonTitanText/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/Converse/Converse.csproj
index 7f752984648..9a843cc1582 100644
--- a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/Converse/Converse.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/Converse/Converse.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/ConverseStream/ConverseStream.csproj b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/ConverseStream/ConverseStream.csproj
index e4e6c3bb250..72b5e19f0b8 100644
--- a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/ConverseStream/ConverseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/ConverseStream/ConverseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModel/InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModel/InvokeModel.csproj
index e4e6c3bb250..72b5e19f0b8 100644
--- a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModel/InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModel/InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
index 0daad35f8b9..6e4dbdf489b 100644
--- a/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/AnthropicClaude/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModel/Command_InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModel/Command_InvokeModel.csproj
index 402f8c682cb..b79f0fd7312 100644
--- a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModel/Command_InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModel/Command_InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModelWithResponseStream/Command_InvokeModelWithResponseStream.csproj b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModelWithResponseStream/Command_InvokeModelWithResponseStream.csproj
index 402f8c682cb..b79f0fd7312 100644
--- a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModelWithResponseStream/Command_InvokeModelWithResponseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_InvokeModelWithResponseStream/Command_InvokeModelWithResponseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModel/Command_R_InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModel/Command_R_InvokeModel.csproj
index 402f8c682cb..b79f0fd7312 100644
--- a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModel/Command_R_InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModel/Command_R_InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModelWithResponseStream/Command_R_InvokeModelWithResponseStream.csproj b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModelWithResponseStream/Command_R_InvokeModelWithResponseStream.csproj
index 402f8c682cb..b79f0fd7312 100644
--- a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModelWithResponseStream/Command_R_InvokeModelWithResponseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Command_R_InvokeModelWithResponseStream/Command_R_InvokeModelWithResponseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Converse/Converse.csproj
index 402f8c682cb..b79f0fd7312 100644
--- a/dotnetv3/Bedrock-runtime/Models/CohereCommand/Converse/Converse.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/CohereCommand/Converse/Converse.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/CohereCommand/ConverseStream/ConverseStream.csproj b/dotnetv3/Bedrock-runtime/Models/CohereCommand/ConverseStream/ConverseStream.csproj
index 402f8c682cb..b79f0fd7312 100644
--- a/dotnetv3/Bedrock-runtime/Models/CohereCommand/ConverseStream/ConverseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/CohereCommand/ConverseStream/ConverseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/MetaLlama/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/MetaLlama/Converse/Converse.csproj
index f91317c7fa6..6163a7486a7 100644
--- a/dotnetv3/Bedrock-runtime/Models/MetaLlama/Converse/Converse.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/MetaLlama/Converse/Converse.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/MetaLlama/ConverseStream/ConverseStream.csproj b/dotnetv3/Bedrock-runtime/Models/MetaLlama/ConverseStream/ConverseStream.csproj
index f91317c7fa6..6163a7486a7 100644
--- a/dotnetv3/Bedrock-runtime/Models/MetaLlama/ConverseStream/ConverseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/MetaLlama/ConverseStream/ConverseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModel/Llama3_InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModel/Llama3_InvokeModel.csproj
index f91317c7fa6..6163a7486a7 100644
--- a/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModel/Llama3_InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModel/Llama3_InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModelWithResponseStream/Llama3_InvokeModelWithResponseStream.csproj b/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModelWithResponseStream/Llama3_InvokeModelWithResponseStream.csproj
index f91317c7fa6..6163a7486a7 100644
--- a/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModelWithResponseStream/Llama3_InvokeModelWithResponseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/MetaLlama/Llama3_InvokeModelWithResponseStream/Llama3_InvokeModelWithResponseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/Mistral/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/Mistral/Converse/Converse.csproj
index 27e936ccbc6..dfbd70d9fc3 100644
--- a/dotnetv3/Bedrock-runtime/Models/Mistral/Converse/Converse.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/Mistral/Converse/Converse.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/Mistral/ConverseStream/ConverseStream.csproj b/dotnetv3/Bedrock-runtime/Models/Mistral/ConverseStream/ConverseStream.csproj
index 8297baab449..9f570ade55e 100644
--- a/dotnetv3/Bedrock-runtime/Models/Mistral/ConverseStream/ConverseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/Mistral/ConverseStream/ConverseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModel/InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModel/InvokeModel.csproj
index 8297baab449..9f570ade55e 100644
--- a/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModel/InvokeModel.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModel/InvokeModel.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj b/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
index 8297baab449..9f570ade55e 100644
--- a/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
+++ b/dotnetv3/Bedrock-runtime/Models/Mistral/InvokeModelWithResponseStream/InvokeModelWithResponseStream.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/dotnetv3/Bedrock-runtime/README.md b/dotnetv3/Bedrock-runtime/README.md
index 9e153544bb9..a51ea913fdc 100644
--- a/dotnetv3/Bedrock-runtime/README.md
+++ b/dotnetv3/Bedrock-runtime/README.md
@@ -33,6 +33,15 @@ For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv3
- [Converse](Models/Ai21LabsJurassic2/Converse/Converse.cs#L4)
- [InvokeModel](Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs#L4)
+### Amazon Nova
+
+- [Converse](Models/AmazonNova/AmazonNovaText/Converse/Converse.cs#L4)
+- [ConverseStream](Models/AmazonNova/AmazonNovaText/ConverseStream/ConverseStream.cs#L4)
+
+### Amazon Nova Canvas
+
+- [InvokeModel](Models/AmazonNova/AmazonNovaCanvas/InvokeModel/InvokeModel.cs#L4)
+
### Amazon Titan Text
- [Converse](Models/AmazonTitanText/Converse/Converse.cs#L4)
@@ -127,4 +136,4 @@ in the `dotnetv3` folder.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
-SPDX-License-Identifier: Apache-2.0
\ No newline at end of file
+SPDX-License-Identifier: Apache-2.0
diff --git a/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs b/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs
index d57db96634e..bb3fafc643d 100644
--- a/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs
+++ b/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs
@@ -10,6 +10,7 @@ public class ActionTest_Converse
[InlineData(typeof(MetaLlama.Converse))]
[InlineData(typeof(CohereCommand.Converse))]
[InlineData(typeof(AnthropicClaude.Converse))]
+ [InlineData(typeof(AmazonNovaText.Converse))]
[InlineData(typeof(AmazonTitanText.Converse))]
[InlineData(typeof(Ai21LabsJurassic2.Converse))]
public void ConverseDoesNotThrow(Type type)
diff --git a/dotnetv3/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs b/dotnetv3/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs
index 3c4ab3417f0..0f6ca41ccac 100644
--- a/dotnetv3/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs
+++ b/dotnetv3/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs
@@ -10,6 +10,7 @@ public class ActionTest_ConverseStream
[InlineData(typeof(MetaLlama.ConverseStream))]
[InlineData(typeof(CohereCommand.ConverseStream))]
[InlineData(typeof(AnthropicClaude.ConverseStream))]
+ [InlineData(typeof(AmazonNovaText.ConverseStream))]
[InlineData(typeof(AmazonTitanText.ConverseStream))]
public void ConverseStreamDoesNotThrow(Type type)
{
diff --git a/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs b/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs
index 0584cf61793..0b561dc2176 100644
--- a/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs
+++ b/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs
@@ -13,6 +13,7 @@ public class ActionTest_InvokeModel
[InlineData(typeof(AnthropicClaude.InvokeModel))]
[InlineData(typeof(AmazonTitanText.InvokeModel))]
[InlineData(typeof(Ai21LabsJurassic2.InvokeModel))]
+ [InlineData(typeof(AmazonNovaCanvas.InvokeModel))]
public void InvokeModelDoesNotThrow(Type type)
{
var entryPoint = type.Assembly.EntryPoint!;
diff --git a/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj b/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj
index b499eb4f7a0..ef74e91feaf 100644
--- a/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj
+++ b/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj
@@ -11,16 +11,16 @@
-
-
-
-
+
+
+
+
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
@@ -29,6 +29,10 @@
+
+
+
+
diff --git a/python/example_code/bedrock-runtime/README.md b/python/example_code/bedrock-runtime/README.md
index dce1178412d..91bca8633dc 100644
--- a/python/example_code/bedrock-runtime/README.md
+++ b/python/example_code/bedrock-runtime/README.md
@@ -48,6 +48,15 @@ python -m pip install -r requirements.txt
- [Converse](models/ai21_labs_jurassic2/converse.py#L4)
- [InvokeModel](models/ai21_labs_jurassic2/invoke_model.py#L4)
+### Amazon Nova
+
+- [Converse](models/amazon_nova/amazon_nova_text/converse.py#L4)
+- [ConverseStream](models/amazon_nova/amazon_nova_text/converse_stream.py#L4)
+
+### Amazon Nova Canvas
+
+- [InvokeModel](models/amazon_nova/amazon_nova_canvas/invoke_model.py#L4)
+
### Amazon Titan Image Generator
- [InvokeModel](models/amazon_titan_image_generator/invoke_model.py#L4)
diff --git a/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_canvas/invoke_model.py b/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_canvas/invoke_model.py
new file mode 100644
index 00000000000..0e479fbf832
--- /dev/null
+++ b/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_canvas/invoke_model.py
@@ -0,0 +1,66 @@
+# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+# snippet-start:[python.example_code.bedrock-runtime.InvokeModel_AmazonNovaImageGeneration]
+# Use the native inference API to create an image with Amazon Nova Canvas
+
+import base64
+import json
+import os
+import random
+
+import boto3
+
+# Create a Bedrock Runtime client in the AWS Region of your choice.
+client = boto3.client("bedrock-runtime", region_name="us-east-1")
+
+# Set the model ID.
+model_id = "amazon.nova-canvas-v1:0"
+
+# Define the image generation prompt for the model.
+prompt = "A stylized picture of a cute old steampunk robot."
+
+# Generate a random seed between 0 and 858,993,459
+seed = random.randint(0, 858993460)
+
+# Format the request payload using the model's native structure.
+native_request = {
+ "taskType": "TEXT_IMAGE",
+ "textToImageParams": {"text": prompt},
+ "imageGenerationConfig": {
+ "seed": seed,
+ "quality": "standard",
+ "height": 512,
+ "width": 512,
+ "numberOfImages": 1,
+ },
+}
+
+# Convert the native request to JSON.
+request = json.dumps(native_request)
+
+# Invoke the model with the request.
+response = client.invoke_model(modelId=model_id, body=request)
+
+# Decode the response body.
+model_response = json.loads(response["body"].read())
+
+# Extract the image data.
+base64_image_data = model_response["images"][0]
+
+# Save the generated image to a local folder.
+i, output_dir = 1, "output"
+if not os.path.exists(output_dir):
+ os.makedirs(output_dir)
+while os.path.exists(os.path.join(output_dir, f"nova_canvas_{i}.png")):
+ i += 1
+
+image_data = base64.b64decode(base64_image_data)
+
+image_path = os.path.join(output_dir, f"nova_canvas_{i}.png")
+with open(image_path, "wb") as file:
+ file.write(image_data)
+
+print(f"The generated image has been saved to {image_path}")
+
+# snippet-end:[python.example_code.bedrock-runtime.InvokeModel_AmazonNovaImageGeneration]
diff --git a/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_text/converse.py b/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_text/converse.py
new file mode 100644
index 00000000000..3000a6a62f2
--- /dev/null
+++ b/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_text/converse.py
@@ -0,0 +1,41 @@
+# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+# snippet-start:[python.example_code.bedrock-runtime.Converse_AmazonNovaText]
+# Use the Conversation API to send a text message to Amazon Nova.
+
+import boto3
+from botocore.exceptions import ClientError
+
+# Create a Bedrock Runtime client in the AWS Region you want to use.
+client = boto3.client("bedrock-runtime", region_name="us-east-1")
+
+# Set the model ID, e.g., Amazon Nova Lite.
+model_id = "amazon.nova-lite-v1:0"
+
+# Start a conversation with the user message.
+user_message = "Describe the purpose of a 'hello world' program in one line."
+conversation = [
+ {
+ "role": "user",
+ "content": [{"text": user_message}],
+ }
+]
+
+try:
+ # Send the message to the model, using a basic inference configuration.
+ response = client.converse(
+ modelId=model_id,
+ messages=conversation,
+ inferenceConfig={"maxTokens": 512, "temperature": 0.5, "topP": 0.9},
+ )
+
+ # Extract and print the response text.
+ response_text = response["output"]["message"]["content"][0]["text"]
+ print(response_text)
+
+except (ClientError, Exception) as e:
+ print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
+ exit(1)
+
+# snippet-end:[python.example_code.bedrock-runtime.Converse_AmazonNovaText]
diff --git a/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_text/converse_stream.py b/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_text/converse_stream.py
new file mode 100644
index 00000000000..a71bacf375f
--- /dev/null
+++ b/python/example_code/bedrock-runtime/models/amazon_nova/amazon_nova_text/converse_stream.py
@@ -0,0 +1,44 @@
+# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+# snippet-start:[python.example_code.bedrock-runtime.ConverseStream_AmazonNovaText]
+# Use the Conversation API to send a text message to Amazon Nova Text
+# and print the response stream.
+
+import boto3
+from botocore.exceptions import ClientError
+
+# Create a Bedrock Runtime client in the AWS Region you want to use.
+client = boto3.client("bedrock-runtime", region_name="us-east-1")
+
+# Set the model ID, e.g., Amazon Nova Lite.
+model_id = "amazon.nova-lite-v1:0"
+
+# Start a conversation with the user message.
+user_message = "Describe the purpose of a 'hello world' program in one line."
+conversation = [
+ {
+ "role": "user",
+ "content": [{"text": user_message}],
+ }
+]
+
+try:
+ # Send the message to the model, using a basic inference configuration.
+ streaming_response = client.converse_stream(
+ modelId=model_id,
+ messages=conversation,
+ inferenceConfig={"maxTokens": 512, "temperature": 0.5, "topP": 0.9},
+ )
+
+ # Extract and print the streamed response text in real-time.
+ for chunk in streaming_response["stream"]:
+ if "contentBlockDelta" in chunk:
+ text = chunk["contentBlockDelta"]["delta"]["text"]
+ print(text, end="")
+
+except (ClientError, Exception) as e:
+ print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
+ exit(1)
+
+# snippet-end:[python.example_code.bedrock-runtime.ConverseStream_AmazonNovaText]
diff --git a/python/example_code/bedrock-runtime/requirements.txt b/python/example_code/bedrock-runtime/requirements.txt
index e084f5d893a..2e935f7aa85 100644
--- a/python/example_code/bedrock-runtime/requirements.txt
+++ b/python/example_code/bedrock-runtime/requirements.txt
@@ -1,35 +1,12 @@
-beautifulsoup4==4.12.3
-boto3==1.35.28
-botocore==1.35.28
-certifi==2024.8.30
-charset-normalizer==3.3.2
+boto3==1.36.22
+botocore==1.36.22
colorama==0.4.6
-contourpy==1.3.0
-cycler==0.12.1
-fonttools==4.54.1
-geojson==3.1.0
-idna==3.10
iniconfig==2.0.0
jmespath==1.0.1
-kiwisolver==1.4.7
-lxml==5.3.0
-matplotlib==3.9.2
-numpy==2.1.1
-packaging==24.1
-pandas==2.2.3
-pillow==10.4.0
-pip-review==1.3.0
+packaging==24.2
pluggy==1.5.0
-pyparsing==3.1.4
-pytest==8.3.3
-pytest-asyncio==0.24.0
+pytest==8.3.4
python-dateutil==2.9.0.post0
-pytz==2024.2
-requests==2.32.3
-s3transfer==0.10.2
-six==1.16.0
-soupsieve==2.6
-tzdata==2024.2
-ujson==5.10.0
-urllib3==2.2.3
-xarray==2024.9.0
+s3transfer==0.11.2
+six==1.17.0
+urllib3==2.3.0
diff --git a/python/example_code/bedrock-runtime/test/test_converse.py b/python/example_code/bedrock-runtime/test/test_converse.py
index a24b9c2fd42..4bcefb110ae 100644
--- a/python/example_code/bedrock-runtime/test/test_converse.py
+++ b/python/example_code/bedrock-runtime/test/test_converse.py
@@ -1,12 +1,14 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
-import pytest
import subprocess
import sys
+import pytest
+
files_under_test = [
"models/ai21_labs_jurassic2/converse.py",
+ "models/amazon_nova/amazon_nova_text/converse.py",
"models/amazon_titan_text/converse.py",
"models/anthropic_claude/converse.py",
"models/cohere_command/converse.py",
diff --git a/python/example_code/bedrock-runtime/test/test_invoke_model.py b/python/example_code/bedrock-runtime/test/test_invoke_model.py
index 1193de8d162..562ad785d8e 100644
--- a/python/example_code/bedrock-runtime/test/test_invoke_model.py
+++ b/python/example_code/bedrock-runtime/test/test_invoke_model.py
@@ -1,13 +1,15 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
-import pytest
import subprocess
import sys
+import pytest
+
files_under_test = [
# Text models
"models/ai21_labs_jurassic2/invoke_model.py",
+ "models/amazon_nova/amazon_nova_canvas/invoke_model.py",
"models/amazon_titan_text/invoke_model.py",
"models/anthropic_claude/invoke_model.py",
"models/cohere_command/command_invoke_model.py",