diff --git a/.doc_gen/metadata/bedrock-runtime_metadata.yaml b/.doc_gen/metadata/bedrock-runtime_metadata.yaml index 3ca5e720fb3..780d085f1e9 100644 --- a/.doc_gen/metadata/bedrock-runtime_metadata.yaml +++ b/.doc_gen/metadata/bedrock-runtime_metadata.yaml @@ -39,42 +39,6 @@ bedrock-runtime_Hello: bedrock-runtime: {InvokeModel} # Converse -bedrock-runtime_Converse_Ai21LabsJurassic2: - title: Invoke AI21 Labs Jurassic-2 on &BR; using Bedrock's Converse API - title_abbrev: "Converse" - synopsis: send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API. - category: AI21 Labs Jurassic-2 - languages: - Java: - versions: - - sdk_version: 2 - github: javav2/example_code/bedrock-runtime - excerpts: - - description: Send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API. - snippet_tags: - - bedrock-runtime.java2.Converse_Ai21LabsJurassic2 - - description: Send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API with the async Java client. - snippet_tags: - - bedrock-runtime.java2.ConverseAsync_Ai21LabsJurassic2 - .NET: - versions: - - sdk_version: 4 - github: dotnetv4/Bedrock-runtime - excerpts: - - description: Send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API. - snippet_tags: - - BedrockRuntime.dotnetv4.Converse_Ai21LabsJurassic2 - Python: - versions: - - sdk_version: 3 - github: python/example_code/bedrock-runtime - excerpts: - - description: Send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API. - snippet_tags: - - python.example_code.bedrock-runtime.Converse_Ai21LabsJurassic2 - services: - bedrock-runtime: {Converse} - bedrock-runtime_Converse_AmazonNovaText: title: Invoke Amazon Nova on &BR; using Bedrock's Converse API title_abbrev: "Converse" @@ -777,48 +741,6 @@ bedrock-runtime_ConverseStream_Mistral: bedrock-runtime: {ConverseStream} # Invoke Model -bedrock-runtime_InvokeModel_Ai21LabsJurassic2: - title: Invoke AI21 Labs Jurassic-2 models on &BR; using the Invoke Model API - title_abbrev: "InvokeModel" - synopsis: send a text message to AI21 Labs Jurassic-2, using the Invoke Model API. - category: AI21 Labs Jurassic-2 - languages: - Java: - versions: - - sdk_version: 2 - github: javav2/example_code/bedrock-runtime - excerpts: - - description: Use the Invoke Model API to send a text message. - snippet_tags: - - bedrock-runtime.java2.InvokeModel_Ai21LabsJurassic2 - .NET: - versions: - - sdk_version: 4 - github: dotnetv4/Bedrock-runtime - excerpts: - - description: Use the Invoke Model API to send a text message. - snippet_tags: - - BedrockRuntime.dotnetv4.InvokeModel_Ai21LabsJurassic2 - Python: - versions: - - sdk_version: 3 - github: python/example_code/bedrock-runtime - excerpts: - - description: Use the Invoke Model API to send a text message. - snippet_tags: - - python.example_code.bedrock-runtime.InvokeModel_Ai21LabsJurassic2 - Go: - versions: - - sdk_version: 2 - github: gov2/bedrock-runtime - excerpts: - - description: Use the Invoke Model API to send a text message. - snippet_tags: - - gov2.bedrock-runtime.InvokeModelWrapper.struct - - gov2.bedrock-runtime.InvokeJurassic2 - services: - bedrock-runtime: {InvokeModel} - bedrock-runtime_InvokeModel_TitanText: title: Invoke Amazon Titan Text models on &BR; using the Invoke Model API title_abbrev: "InvokeModel" diff --git a/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln b/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln index dd290cac66d..f396e0c4bd8 100644 --- a/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln +++ b/dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln @@ -17,7 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test {63984664-8230-40F3-BFF5-7AC4988D7FE7} = {63984664-8230-40F3-BFF5-7AC4988D7FE7} {8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA} = {8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA} {9018AC00-1D39-41DB-9B3F-A0A7FC60AF18} = {9018AC00-1D39-41DB-9B3F-A0A7FC60AF18} - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698} = {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698} {AAE5224C-4947-44C2-8BFB-70AF1F91A6EE} = {AAE5224C-4947-44C2-8BFB-70AF1F91A6EE} {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} = {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} {B753CEB9-EA53-4AE1-997E-B7D54A299D58} = {B753CEB9-EA53-4AE1-997E-B7D54A299D58} @@ -26,7 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test {D1B0719F-4F84-4DBC-BCAD-E856FB3193D7} = {D1B0719F-4F84-4DBC-BCAD-E856FB3193D7} {D3BA31F5-FF20-4321-9494-3F01439C4F61} = {D3BA31F5-FF20-4321-9494-3F01439C4F61} {D96E9BC2-3143-4F95-835C-5F3AAC414B9C} = {D96E9BC2-3143-4F95-835C-5F3AAC414B9C} - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE} = {E153B47E-DBBF-4793-A2C8-89792CB8C6EE} {EFC7D088-EF45-464B-97CD-0BBA486B224A} = {EFC7D088-EF45-464B-97CD-0BBA486B224A} {F6E2F781-D0C6-4912-8E2F-F6C36FDE4785} = {F6E2F781-D0C6-4912-8E2F-F6C36FDE4785} {FCA6CE8F-531C-4C53-A7C1-3E3028A98CC4} = {FCA6CE8F-531C-4C53-A7C1-3E3028A98CC4} @@ -34,8 +32,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Models", "Models", "{41B69207-8F29-41BC-9114-78EE740485C8}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ai21LabsJurassic2", "Ai21LabsJurassic2", "{E88B3BB6-894F-48F7-8D0B-6244F5E2AD29}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AnthropicClaude", "AnthropicClaude", "{8BAC2322-AD3C-484A-B51D-8263BC4E6646}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AmazonTitanText", "AmazonTitanText", "{3F96ECB4-1644-43E8-8643-2CDCF9E679F1}" @@ -46,8 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MetaLlama", "MetaLlama", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mistral", "Mistral", "{BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Models\Ai21LabsJurassic2\Converse\Converse.csproj", "{E153B47E-DBBF-4793-A2C8-89792CB8C6EE}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Models\AmazonTitanText\Converse\Converse.csproj", "{D96E9BC2-3143-4F95-835C-5F3AAC414B9C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Models\AnthropicClaude\Converse\Converse.csproj", "{8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA}" @@ -68,8 +62,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverseStream", "Models\Me EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverseStream", "Models\Mistral\ConverseStream\ConverseStream.csproj", "{B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\Ai21LabsJurassic2\InvokeModel\InvokeModel.csproj", "{A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\AmazonTitanText\InvokeModel\InvokeModel.csproj", "{3D6441FC-0FE8-4D0C-910D-3D9310599C71}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\AnthropicClaude\InvokeModel\InvokeModel.csproj", "{D1B0719F-4F84-4DBC-BCAD-E856FB3193D7}" @@ -124,10 +116,6 @@ Global {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700}.Debug|Any CPU.Build.0 = Debug|Any CPU {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700}.Release|Any CPU.ActiveCfg = Release|Any CPU {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700}.Release|Any CPU.Build.0 = Release|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Release|Any CPU.Build.0 = Release|Any CPU {D96E9BC2-3143-4F95-835C-5F3AAC414B9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D96E9BC2-3143-4F95-835C-5F3AAC414B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D96E9BC2-3143-4F95-835C-5F3AAC414B9C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -168,10 +156,6 @@ Global {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}.Release|Any CPU.Build.0 = Release|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Release|Any CPU.Build.0 = Release|Any CPU {3D6441FC-0FE8-4D0C-910D-3D9310599C71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D6441FC-0FE8-4D0C-910D-3D9310599C71}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D6441FC-0FE8-4D0C-910D-3D9310599C71}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -246,13 +230,11 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700} = {E2AD9F91-E6D4-412D-A07A-E004042ADF30} - {E88B3BB6-894F-48F7-8D0B-6244F5E2AD29} = {41B69207-8F29-41BC-9114-78EE740485C8} {8BAC2322-AD3C-484A-B51D-8263BC4E6646} = {41B69207-8F29-41BC-9114-78EE740485C8} {3F96ECB4-1644-43E8-8643-2CDCF9E679F1} = {41B69207-8F29-41BC-9114-78EE740485C8} {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C} = {41B69207-8F29-41BC-9114-78EE740485C8} {65504C76-7E32-4A12-A42E-BCDA4FE79BC1} = {41B69207-8F29-41BC-9114-78EE740485C8} {BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B} = {41B69207-8F29-41BC-9114-78EE740485C8} - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE} = {E88B3BB6-894F-48F7-8D0B-6244F5E2AD29} {D96E9BC2-3143-4F95-835C-5F3AAC414B9C} = {3F96ECB4-1644-43E8-8643-2CDCF9E679F1} {8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA} = {8BAC2322-AD3C-484A-B51D-8263BC4E6646} {CDF1A045-0888-418C-8656-2BF5E3348A48} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C} @@ -263,7 +245,6 @@ Global {0574B2F4-D4BE-4155-902B-BF3D7CE4804E} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C} {D3BA31F5-FF20-4321-9494-3F01439C4F61} = {65504C76-7E32-4A12-A42E-BCDA4FE79BC1} {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} = {BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B} - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698} = {E88B3BB6-894F-48F7-8D0B-6244F5E2AD29} {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} diff --git a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.cs b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.cs deleted file mode 100644 index bcf174d0dbf..00000000000 --- a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -// snippet-start:[BedrockRuntime.dotnetv3.Converse_Ai21LabsJurassic2] -// 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 - { - 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_Ai21LabsJurassic2] - -// Create a partial class to make the top-level script testable. -namespace Ai21LabsJurassic2 { public partial class Converse { } } \ No newline at end of file diff --git a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj deleted file mode 100644 index c26f412667b..00000000000 --- a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - Exe - net8.0 - Ai21LabsJurassic2.$(MSBuildProjectName) - - - - - - - diff --git a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs deleted file mode 100644 index cbb233083d0..00000000000 --- a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -// snippet-start:[BedrockRuntime.dotnetv3.InvokeModel_Ai21LabsJurassic2] -// 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; -} - -// snippet-end:[BedrockRuntime.dotnetv3.InvokeModel_Ai21LabsJurassic2] - -// Create a partial class to make the top-level script testable. -namespace Ai21LabsJurassic2 { public partial class InvokeModel { } } \ No newline at end of file diff --git a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj b/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj deleted file mode 100644 index 986018da574..00000000000 --- a/dotnetv3/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - Exe - net8.0 - Ai21LabsJurassic2.$(MSBuildProjectName) - - - - - - - diff --git a/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs b/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs index bb3fafc643d..10ee89efba5 100644 --- a/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs +++ b/dotnetv3/Bedrock-runtime/Tests/ActionTest_Converse.cs @@ -12,7 +12,7 @@ public class ActionTest_Converse [InlineData(typeof(AnthropicClaude.Converse))] [InlineData(typeof(AmazonNovaText.Converse))] [InlineData(typeof(AmazonTitanText.Converse))] - [InlineData(typeof(Ai21LabsJurassic2.Converse))] + public void ConverseDoesNotThrow(Type type) { var entryPoint = type.Assembly.EntryPoint!; diff --git a/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs b/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs index 0b561dc2176..35358828d1c 100644 --- a/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs +++ b/dotnetv3/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs @@ -12,7 +12,6 @@ public class ActionTest_InvokeModel [InlineData(typeof(CohereCommandR.InvokeModel))] [InlineData(typeof(AnthropicClaude.InvokeModel))] [InlineData(typeof(AmazonTitanText.InvokeModel))] - [InlineData(typeof(Ai21LabsJurassic2.InvokeModel))] [InlineData(typeof(AmazonNovaCanvas.InvokeModel))] public void InvokeModelDoesNotThrow(Type type) { diff --git a/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj b/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj index 6c0e8620b3e..c46d5b1ec25 100644 --- a/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj +++ b/dotnetv3/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj @@ -27,9 +27,7 @@ - - - + diff --git a/dotnetv3/DotNetV3Examples.sln b/dotnetv3/DotNetV3Examples.sln index 908a808da58..105e2a922a7 100644 --- a/dotnetv3/DotNetV3Examples.sln +++ b/dotnetv3/DotNetV3Examples.sln @@ -799,12 +799,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverseStream", "Bedrock-r EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Bedrock-runtime\Models\AmazonTitanText\Converse\Converse.csproj", "{BDF20166-BEC9-4D00-A4AE-D7A6BFC527FB}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ai21LabsJurassic2", "Ai21LabsJurassic2", "{24C72634-66CF-43F3-9099-F96B8FDDF2BE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Bedrock-runtime\Models\Ai21LabsJurassic2\InvokeModel\InvokeModel.csproj", "{DC534ADA-1E96-4203-98D9-418EF14E66DC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Bedrock-runtime\Models\Ai21LabsJurassic2\Converse\Converse.csproj", "{34B9BD63-314B-4238-9651-928BA8D69848}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeActions", "Bedrock-runtime\Actions\BedrockRuntimeActions.csproj", "{2BE9EAF8-C8C7-4B84-B4BC-C6C91A1D582D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EventBridge Scheduler", "EventBridge Scheduler", "{BEF5CCF6-92DC-40AD-8789-5A00DE2CDD4F}" @@ -1881,14 +1875,6 @@ Global {BDF20166-BEC9-4D00-A4AE-D7A6BFC527FB}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDF20166-BEC9-4D00-A4AE-D7A6BFC527FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDF20166-BEC9-4D00-A4AE-D7A6BFC527FB}.Release|Any CPU.Build.0 = Release|Any CPU - {DC534ADA-1E96-4203-98D9-418EF14E66DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC534ADA-1E96-4203-98D9-418EF14E66DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC534ADA-1E96-4203-98D9-418EF14E66DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC534ADA-1E96-4203-98D9-418EF14E66DC}.Release|Any CPU.Build.0 = Release|Any CPU - {34B9BD63-314B-4238-9651-928BA8D69848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {34B9BD63-314B-4238-9651-928BA8D69848}.Debug|Any CPU.Build.0 = Debug|Any CPU - {34B9BD63-314B-4238-9651-928BA8D69848}.Release|Any CPU.ActiveCfg = Release|Any CPU - {34B9BD63-314B-4238-9651-928BA8D69848}.Release|Any CPU.Build.0 = Release|Any CPU {2BE9EAF8-C8C7-4B84-B4BC-C6C91A1D582D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2BE9EAF8-C8C7-4B84-B4BC-C6C91A1D582D}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BE9EAF8-C8C7-4B84-B4BC-C6C91A1D582D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -2318,9 +2304,6 @@ Global {11287DA7-B956-4857-A733-BC1890788BFF} = {D6E28F78-4CFB-4C9F-B6E4-29B5E1AAFC5B} {6DC5F00F-4EA5-44A7-8842-977F1D9E32B3} = {D6E28F78-4CFB-4C9F-B6E4-29B5E1AAFC5B} {BDF20166-BEC9-4D00-A4AE-D7A6BFC527FB} = {D6E28F78-4CFB-4C9F-B6E4-29B5E1AAFC5B} - {24C72634-66CF-43F3-9099-F96B8FDDF2BE} = {6520EB28-F7B4-4581-B3D8-A06E9303B16B} - {DC534ADA-1E96-4203-98D9-418EF14E66DC} = {24C72634-66CF-43F3-9099-F96B8FDDF2BE} - {34B9BD63-314B-4238-9651-928BA8D69848} = {24C72634-66CF-43F3-9099-F96B8FDDF2BE} {2BE9EAF8-C8C7-4B84-B4BC-C6C91A1D582D} = {BA23BB28-EC63-4330-8CA7-DEB1B6489580} {C419E2E9-960A-4EF2-A287-39404624BD20} = {BEF5CCF6-92DC-40AD-8789-5A00DE2CDD4F} {18FA46A8-B626-467A-8F82-B641A8F549D5} = {BEF5CCF6-92DC-40AD-8789-5A00DE2CDD4F} diff --git a/dotnetv4/Bedrock-runtime/BedrockRuntimeExamples.sln b/dotnetv4/Bedrock-runtime/BedrockRuntimeExamples.sln index 86bfe5a13a5..a2947fd6703 100644 --- a/dotnetv4/Bedrock-runtime/BedrockRuntimeExamples.sln +++ b/dotnetv4/Bedrock-runtime/BedrockRuntimeExamples.sln @@ -17,7 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test {63984664-8230-40F3-BFF5-7AC4988D7FE7} = {63984664-8230-40F3-BFF5-7AC4988D7FE7} {8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA} = {8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA} {9018AC00-1D39-41DB-9B3F-A0A7FC60AF18} = {9018AC00-1D39-41DB-9B3F-A0A7FC60AF18} - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698} = {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698} {AAE5224C-4947-44C2-8BFB-70AF1F91A6EE} = {AAE5224C-4947-44C2-8BFB-70AF1F91A6EE} {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} = {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} {B753CEB9-EA53-4AE1-997E-B7D54A299D58} = {B753CEB9-EA53-4AE1-997E-B7D54A299D58} @@ -26,7 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test {D1B0719F-4F84-4DBC-BCAD-E856FB3193D7} = {D1B0719F-4F84-4DBC-BCAD-E856FB3193D7} {D3BA31F5-FF20-4321-9494-3F01439C4F61} = {D3BA31F5-FF20-4321-9494-3F01439C4F61} {D96E9BC2-3143-4F95-835C-5F3AAC414B9C} = {D96E9BC2-3143-4F95-835C-5F3AAC414B9C} - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE} = {E153B47E-DBBF-4793-A2C8-89792CB8C6EE} {EFC7D088-EF45-464B-97CD-0BBA486B224A} = {EFC7D088-EF45-464B-97CD-0BBA486B224A} {F6E2F781-D0C6-4912-8E2F-F6C36FDE4785} = {F6E2F781-D0C6-4912-8E2F-F6C36FDE4785} {FCA6CE8F-531C-4C53-A7C1-3E3028A98CC4} = {FCA6CE8F-531C-4C53-A7C1-3E3028A98CC4} @@ -34,8 +32,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Models", "Models", "{41B69207-8F29-41BC-9114-78EE740485C8}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ai21LabsJurassic2", "Ai21LabsJurassic2", "{E88B3BB6-894F-48F7-8D0B-6244F5E2AD29}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AnthropicClaude", "AnthropicClaude", "{8BAC2322-AD3C-484A-B51D-8263BC4E6646}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AmazonTitanText", "AmazonTitanText", "{3F96ECB4-1644-43E8-8643-2CDCF9E679F1}" @@ -46,8 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MetaLlama", "MetaLlama", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mistral", "Mistral", "{BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Models\Ai21LabsJurassic2\Converse\Converse.csproj", "{E153B47E-DBBF-4793-A2C8-89792CB8C6EE}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Models\AmazonTitanText\Converse\Converse.csproj", "{D96E9BC2-3143-4F95-835C-5F3AAC414B9C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Converse", "Models\AnthropicClaude\Converse\Converse.csproj", "{8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA}" @@ -68,8 +62,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverseStream", "Models\Me EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConverseStream", "Models\Mistral\ConverseStream\ConverseStream.csproj", "{B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\Ai21LabsJurassic2\InvokeModel\InvokeModel.csproj", "{A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\AmazonTitanText\InvokeModel\InvokeModel.csproj", "{3D6441FC-0FE8-4D0C-910D-3D9310599C71}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\AnthropicClaude\InvokeModel\InvokeModel.csproj", "{D1B0719F-4F84-4DBC-BCAD-E856FB3193D7}" @@ -104,10 +96,6 @@ Global {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700}.Debug|Any CPU.Build.0 = Debug|Any CPU {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700}.Release|Any CPU.ActiveCfg = Release|Any CPU {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700}.Release|Any CPU.Build.0 = Release|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE}.Release|Any CPU.Build.0 = Release|Any CPU {D96E9BC2-3143-4F95-835C-5F3AAC414B9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D96E9BC2-3143-4F95-835C-5F3AAC414B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D96E9BC2-3143-4F95-835C-5F3AAC414B9C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -148,10 +136,6 @@ Global {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}.Release|Any CPU.Build.0 = Release|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698}.Release|Any CPU.Build.0 = Release|Any CPU {3D6441FC-0FE8-4D0C-910D-3D9310599C71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D6441FC-0FE8-4D0C-910D-3D9310599C71}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D6441FC-0FE8-4D0C-910D-3D9310599C71}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -206,13 +190,11 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {6DF749A5-67E4-4F4E-BA64-A2D3F00E4700} = {E2AD9F91-E6D4-412D-A07A-E004042ADF30} - {E88B3BB6-894F-48F7-8D0B-6244F5E2AD29} = {41B69207-8F29-41BC-9114-78EE740485C8} {8BAC2322-AD3C-484A-B51D-8263BC4E6646} = {41B69207-8F29-41BC-9114-78EE740485C8} {3F96ECB4-1644-43E8-8643-2CDCF9E679F1} = {41B69207-8F29-41BC-9114-78EE740485C8} {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C} = {41B69207-8F29-41BC-9114-78EE740485C8} {65504C76-7E32-4A12-A42E-BCDA4FE79BC1} = {41B69207-8F29-41BC-9114-78EE740485C8} {BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B} = {41B69207-8F29-41BC-9114-78EE740485C8} - {E153B47E-DBBF-4793-A2C8-89792CB8C6EE} = {E88B3BB6-894F-48F7-8D0B-6244F5E2AD29} {D96E9BC2-3143-4F95-835C-5F3AAC414B9C} = {3F96ECB4-1644-43E8-8643-2CDCF9E679F1} {8D40F644-A2EB-46F0-B0A0-C7B7B563E6BA} = {8BAC2322-AD3C-484A-B51D-8263BC4E6646} {CDF1A045-0888-418C-8656-2BF5E3348A48} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C} @@ -223,7 +205,6 @@ Global {0574B2F4-D4BE-4155-902B-BF3D7CE4804E} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C} {D3BA31F5-FF20-4321-9494-3F01439C4F61} = {65504C76-7E32-4A12-A42E-BCDA4FE79BC1} {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} = {BBB79D3E-5DF2-4FF6-B467-52D0EEB91C4B} - {A992A4DD-FEEE-40B6-8EA1-AEA3EF612698} = {E88B3BB6-894F-48F7-8D0B-6244F5E2AD29} {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} diff --git a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.cs b/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.cs deleted file mode 100644 index ecdb3f88f0e..00000000000 --- a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -// snippet-start:[BedrockRuntime.dotnetv4.Converse_Ai21LabsJurassic2] -// 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 - { - 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.dotnetv4.Converse_Ai21LabsJurassic2] - -// Create a partial class to make the top-level script testable. -namespace Ai21LabsJurassic2 { public partial class Converse { } } \ No newline at end of file diff --git a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj b/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj deleted file mode 100644 index b56610d48bd..00000000000 --- a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/Converse/Converse.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - Exe - net8.0 - Ai21LabsJurassic2.$(MSBuildProjectName) - - - - - - - diff --git a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs b/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs deleted file mode 100644 index 9e323cd8312..00000000000 --- a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -// snippet-start:[BedrockRuntime.dotnetv4.InvokeModel_Ai21LabsJurassic2] -// 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; -} - -// snippet-end:[BedrockRuntime.dotnetv4.InvokeModel_Ai21LabsJurassic2] - -// Create a partial class to make the top-level script testable. -namespace Ai21LabsJurassic2 { public partial class InvokeModel { } } \ No newline at end of file diff --git a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj b/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj deleted file mode 100644 index b224d8131fb..00000000000 --- a/dotnetv4/Bedrock-runtime/Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - Exe - net8.0 - Ai21LabsJurassic2.$(MSBuildProjectName) - - - - - - - diff --git a/dotnetv4/Bedrock-runtime/README.md b/dotnetv4/Bedrock-runtime/README.md index dcd0537295b..c3b416815b2 100644 --- a/dotnetv4/Bedrock-runtime/README.md +++ b/dotnetv4/Bedrock-runtime/README.md @@ -28,11 +28,6 @@ For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv4 -### AI21 Labs Jurassic-2 - -- [Converse](Models/Ai21LabsJurassic2/Converse/Converse.cs#L4) -- [InvokeModel](Models/Ai21LabsJurassic2/InvokeModel/InvokeModel.cs#L4) - ### Amazon Titan Text - [Converse](Models/AmazonTitanText/Converse/Converse.cs#L4) diff --git a/dotnetv4/Bedrock-runtime/Tests/ActionTest_Converse.cs b/dotnetv4/Bedrock-runtime/Tests/ActionTest_Converse.cs index d57db96634e..1495e42b66d 100644 --- a/dotnetv4/Bedrock-runtime/Tests/ActionTest_Converse.cs +++ b/dotnetv4/Bedrock-runtime/Tests/ActionTest_Converse.cs @@ -6,14 +6,14 @@ namespace BedrockRuntimeTests; public class ActionTest_Converse { [Theory, Trait("Category", "Integration")] + [InlineData(typeof(AmazonTitanText.Converse))] [InlineData(typeof(Mistral.Converse))] [InlineData(typeof(MetaLlama.Converse))] [InlineData(typeof(CohereCommand.Converse))] [InlineData(typeof(AnthropicClaude.Converse))] - [InlineData(typeof(AmazonTitanText.Converse))] - [InlineData(typeof(Ai21LabsJurassic2.Converse))] public void ConverseDoesNotThrow(Type type) { + Thread.Sleep(5000); var entryPoint = type.Assembly.EntryPoint!; var exception = Record.Exception(() => entryPoint.Invoke(null, [Array.Empty()])); Assert.Null(exception); diff --git a/dotnetv4/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs b/dotnetv4/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs index 3c4ab3417f0..d5c0a5f452f 100644 --- a/dotnetv4/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs +++ b/dotnetv4/Bedrock-runtime/Tests/ActionTest_ConverseStream.cs @@ -6,13 +6,14 @@ namespace BedrockRuntimeTests; public class ActionTest_ConverseStream { [Theory, Trait("Category", "Integration")] + [InlineData(typeof(AmazonTitanText.ConverseStream))] [InlineData(typeof(Mistral.ConverseStream))] [InlineData(typeof(MetaLlama.ConverseStream))] [InlineData(typeof(CohereCommand.ConverseStream))] [InlineData(typeof(AnthropicClaude.ConverseStream))] - [InlineData(typeof(AmazonTitanText.ConverseStream))] public void ConverseStreamDoesNotThrow(Type type) { + Thread.Sleep(5000); var entryPoint = type.Assembly.EntryPoint!; var exception = Record.Exception(() => entryPoint.Invoke(null, [Array.Empty()])); Assert.Null(exception); diff --git a/dotnetv4/Bedrock-runtime/Tests/ActionTest_InvokeModelWithResponseStream.cs b/dotnetv4/Bedrock-runtime/Tests/ActionTest_InvokeModelWithResponseStream.cs index c0520fa0d25..f9c56201200 100644 --- a/dotnetv4/Bedrock-runtime/Tests/ActionTest_InvokeModelWithResponseStream.cs +++ b/dotnetv4/Bedrock-runtime/Tests/ActionTest_InvokeModelWithResponseStream.cs @@ -6,14 +6,16 @@ namespace BedrockRuntimeTests public class ActionTest_InvokeModelWithResponseStream { [Theory, Trait("Category", "Integration")] + [InlineData(typeof(AmazonTitanText.InvokeModelWithResponseStream))] [InlineData(typeof(Mistral.InvokeModelWithResponseStream))] [InlineData(typeof(MetaLlama3.InvokeModelWithResponseStream))] [InlineData(typeof(CohereCommand.InvokeModelWithResponseStream))] [InlineData(typeof(CohereCommandR.InvokeModelWithResponseStream))] [InlineData(typeof(AnthropicClaude.InvokeModelWithResponseStream))] - [InlineData(typeof(AmazonTitanText.InvokeModelWithResponseStream))] + public void InvokeModelWithResponseStreamDoesNotThrow(Type type) { + Thread.Sleep(5000); var entryPoint = type.Assembly.EntryPoint!; var exception = Record.Exception(() => entryPoint.Invoke(null, [Array.Empty()])); Assert.Null(exception); diff --git a/dotnetv4/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs b/dotnetv4/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs index 0584cf61793..9512876fc37 100644 --- a/dotnetv4/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs +++ b/dotnetv4/Bedrock-runtime/Tests/ActionTests_InvokeModel.cs @@ -6,15 +6,16 @@ namespace BedrockRuntimeTests; public class ActionTest_InvokeModel { [Theory, Trait("Category", "Integration")] + [InlineData(typeof(AmazonTitanText.InvokeModel))] [InlineData(typeof(Mistral.InvokeModel))] [InlineData(typeof(MetaLlama3.InvokeModel))] [InlineData(typeof(CohereCommand.InvokeModel))] [InlineData(typeof(CohereCommandR.InvokeModel))] [InlineData(typeof(AnthropicClaude.InvokeModel))] - [InlineData(typeof(AmazonTitanText.InvokeModel))] - [InlineData(typeof(Ai21LabsJurassic2.InvokeModel))] + public void InvokeModelDoesNotThrow(Type type) { + Thread.Sleep(5000); var entryPoint = type.Assembly.EntryPoint!; var exception = Record.Exception(() => entryPoint.Invoke(null, [Array.Empty()])); Assert.Null(exception); diff --git a/dotnetv4/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj b/dotnetv4/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj index 68e2b8bc617..b41309ed432 100644 --- a/dotnetv4/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj +++ b/dotnetv4/Bedrock-runtime/Tests/BedrockRuntimeTests.csproj @@ -28,9 +28,7 @@ - - - + diff --git a/dotnetv4/DotNetV4Examples.sln b/dotnetv4/DotNetV4Examples.sln index 55584997279..3601dee4165 100644 --- a/dotnetv4/DotNetV4Examples.sln +++ b/dotnetv4/DotNetV4Examples.sln @@ -87,12 +87,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConverseStream", "Bedrock-r EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Converse", "Bedrock-runtime\Models\AmazonTitanText\Converse\Converse.csproj", "{3EA8A897-A32D-42B6-B87E-CE269E4597D5}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ai21LabsJurassic2", "Ai21LabsJurassic2", "{017F0D68-919C-41EF-9E33-087D91BA55CE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InvokeModel", "Bedrock-runtime\Models\Ai21LabsJurassic2\InvokeModel\InvokeModel.csproj", "{48041B99-B3B8-4970-B9AA-AB2591EA5E55}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Converse", "Bedrock-runtime\Models\Ai21LabsJurassic2\Converse\Converse.csproj", "{8D8B72F0-E17E-4A85-93B1-D035E5B81A33}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BedrockRuntimeActions", "Bedrock-runtime\Actions\BedrockRuntimeActions.csproj", "{05E93A3E-CFA0-4980-8EE5-CD25C7ED766D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CloudFormation", "CloudFormation", "{5FBEAD92-9234-4824-9320-2052D236C9CD}" @@ -267,14 +261,6 @@ Global {3EA8A897-A32D-42B6-B87E-CE269E4597D5}.Debug|Any CPU.Build.0 = Debug|Any CPU {3EA8A897-A32D-42B6-B87E-CE269E4597D5}.Release|Any CPU.ActiveCfg = Release|Any CPU {3EA8A897-A32D-42B6-B87E-CE269E4597D5}.Release|Any CPU.Build.0 = Release|Any CPU - {48041B99-B3B8-4970-B9AA-AB2591EA5E55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48041B99-B3B8-4970-B9AA-AB2591EA5E55}.Debug|Any CPU.Build.0 = Debug|Any CPU - {48041B99-B3B8-4970-B9AA-AB2591EA5E55}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48041B99-B3B8-4970-B9AA-AB2591EA5E55}.Release|Any CPU.Build.0 = Release|Any CPU - {8D8B72F0-E17E-4A85-93B1-D035E5B81A33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8D8B72F0-E17E-4A85-93B1-D035E5B81A33}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8D8B72F0-E17E-4A85-93B1-D035E5B81A33}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8D8B72F0-E17E-4A85-93B1-D035E5B81A33}.Release|Any CPU.Build.0 = Release|Any CPU {05E93A3E-CFA0-4980-8EE5-CD25C7ED766D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {05E93A3E-CFA0-4980-8EE5-CD25C7ED766D}.Debug|Any CPU.Build.0 = Debug|Any CPU {05E93A3E-CFA0-4980-8EE5-CD25C7ED766D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -378,9 +364,6 @@ Global {18E636A2-A383-487C-AB19-B133B50173F2} = {74979310-8A92-47DC-B5CA-EFA7970E1202} {AD2DCA34-3627-43EC-BEE7-7D1104FC521A} = {74979310-8A92-47DC-B5CA-EFA7970E1202} {3EA8A897-A32D-42B6-B87E-CE269E4597D5} = {74979310-8A92-47DC-B5CA-EFA7970E1202} - {017F0D68-919C-41EF-9E33-087D91BA55CE} = {4429C078-35C8-4E2B-9C7B-F0C619741B67} - {48041B99-B3B8-4970-B9AA-AB2591EA5E55} = {017F0D68-919C-41EF-9E33-087D91BA55CE} - {8D8B72F0-E17E-4A85-93B1-D035E5B81A33} = {017F0D68-919C-41EF-9E33-087D91BA55CE} {05E93A3E-CFA0-4980-8EE5-CD25C7ED766D} = {D859B39C-9106-4D3D-8C57-11B15FA8106B} {AAFC86EB-49D7-4FD8-8C79-C42C129EB75A} = {5FBEAD92-9234-4824-9320-2052D236C9CD} {98A11016-DD41-4848-A848-51D703951A91} = {5FBEAD92-9234-4824-9320-2052D236C9CD} diff --git a/gov2/bedrock-runtime/README.md b/gov2/bedrock-runtime/README.md index 6c2047a3b52..8efda951903 100644 --- a/gov2/bedrock-runtime/README.md +++ b/gov2/bedrock-runtime/README.md @@ -40,10 +40,6 @@ functions within the same service. - [Invoke multiple foundation models on Amazon Bedrock](scenarios/scenario_invoke_models.go) -### AI21 Labs Jurassic-2 - -- [InvokeModel](actions/invoke_model.go#L7) - ### Amazon Titan Image Generator - [InvokeModel](actions/invoke_model.go#L7) diff --git a/javav2/example_code/bedrock-runtime/README.md b/javav2/example_code/bedrock-runtime/README.md index 625219c78a0..7a9d19de970 100644 --- a/javav2/example_code/bedrock-runtime/README.md +++ b/javav2/example_code/bedrock-runtime/README.md @@ -42,11 +42,6 @@ functions within the same service. - [Generate videos from text prompts using Amazon Bedrock](../../usecases/video_generation_bedrock_nova_reel/src/main/java/com/example/novareel/VideoGenerationService.java) - [Tool use with the Converse API](src/main/java/com/example/bedrockruntime/scenario/BedrockScenario.java) -### AI21 Labs Jurassic-2 - -- [Converse](src/main/java/com/example/bedrockruntime/models/ai21LabsJurassic2/Converse.java#L6) -- [InvokeModel](src/main/java/com/example/bedrockruntime/models/ai21LabsJurassic2/InvokeModel.java#L6) - ### Amazon Nova - [Converse](src/main/java/com/example/bedrockruntime/models/amazon/nova/text/ConverseAsync.java#L6) diff --git a/python/example_code/bedrock-runtime/README.md b/python/example_code/bedrock-runtime/README.md index 630bc0f4aee..18c7a076e87 100644 --- a/python/example_code/bedrock-runtime/README.md +++ b/python/example_code/bedrock-runtime/README.md @@ -51,11 +51,6 @@ functions within the same service. - [Create and invoke a managed prompt](../bedrock-agent/prompts/scenario_get_started_with_prompts.py) - [Tool use with the Converse API](cross-model-scenarios/tool_use_demo/tool_use_demo.py) -### AI21 Labs Jurassic-2 - -- [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) diff --git a/python/example_code/bedrock-runtime/models/ai21_labs_jurassic2/converse.py b/python/example_code/bedrock-runtime/models/ai21_labs_jurassic2/converse.py deleted file mode 100644 index cf0e7dba13c..00000000000 --- a/python/example_code/bedrock-runtime/models/ai21_labs_jurassic2/converse.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -# snippet-start:[python.example_code.bedrock-runtime.Converse_Ai21LabsJurassic2] -# Use the Conversation API to send a text message to AI21 Labs Jurassic-2. - -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., Jurassic-2 Mid. -model_id = "ai21.j2-mid-v1" - -# 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_Ai21LabsJurassic2] diff --git a/python/example_code/bedrock-runtime/models/ai21_labs_jurassic2/invoke_model.py b/python/example_code/bedrock-runtime/models/ai21_labs_jurassic2/invoke_model.py deleted file mode 100644 index bf54beaef4a..00000000000 --- a/python/example_code/bedrock-runtime/models/ai21_labs_jurassic2/invoke_model.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -# snippet-start:[python.example_code.bedrock-runtime.InvokeModel_Ai21LabsJurassic2] -# Use the native inference API to send a text message to AI21 Labs Jurassic-2. - -import boto3 -import json - -from botocore.exceptions import ClientError - -# 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, e.g., Jurassic-2 Mid. -model_id = "ai21.j2-mid-v1" - -# Define the prompt for the model. -prompt = "Describe the purpose of a 'hello world' program in one line." - -# Format the request payload using the model's native structure. -native_request = { - "prompt": prompt, - "maxTokens": 512, - "temperature": 0.5, -} - -# Convert the native request to JSON. -request = json.dumps(native_request) - -try: - # Invoke the model with the request. - response = client.invoke_model(modelId=model_id, body=request) - -except (ClientError, Exception) as e: - print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}") - exit(1) - -# Decode the response body. -model_response = json.loads(response["body"].read()) - -# Extract and print the response text. -response_text = model_response["completions"][0]["data"]["text"] -print(response_text) - -# snippet-end:[python.example_code.bedrock-runtime.InvokeModel_Ai21LabsJurassic2] diff --git a/python/example_code/bedrock-runtime/test/test_converse.py b/python/example_code/bedrock-runtime/test/test_converse.py index 4bcefb110ae..d781c7e6f2d 100644 --- a/python/example_code/bedrock-runtime/test/test_converse.py +++ b/python/example_code/bedrock-runtime/test/test_converse.py @@ -7,7 +7,6 @@ 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", 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 562ad785d8e..f9c28e1c65e 100644 --- a/python/example_code/bedrock-runtime/test/test_invoke_model.py +++ b/python/example_code/bedrock-runtime/test/test_invoke_model.py @@ -8,7 +8,6 @@ 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", diff --git a/python/test_tools/bedrock_runtime_stubber.py b/python/test_tools/bedrock_runtime_stubber.py index eac1872e866..e9e0109cd1c 100644 --- a/python/test_tools/bedrock_runtime_stubber.py +++ b/python/test_tools/bedrock_runtime_stubber.py @@ -103,26 +103,6 @@ def stub_invoke_claude(self, prompt, error_code=None): "invoke_model", expected_params, response, error_code=error_code ) - def stub_invoke_jurassic2(self, prompt, error_code=None): - expected_params = { - "modelId": "ai21.j2-mid-v1", - "body": json.dumps( - {"prompt": prompt, "temperature": 0.5, "maxTokens": 200} - ), - } - - response_body = io.BytesIO( - json.dumps( - {"completions": [{"data": {"text": "Fake completion response."}}]} - ).encode("utf-8") - ) - - response = {"body": response_body, "contentType": ""} - - self._stub_bifurcator( - "invoke_model", expected_params, response, error_code=error_code - ) - def stub_invoke_model_with_response_stream(self, prompt, error_code=None): expected_params = { "modelId": "anthropic.claude-v2",