Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions .doc_gen/metadata/bedrock-runtime_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -765,64 +765,6 @@ bedrock-runtime_InvokeModel_CohereCommandR:
services:
bedrock-runtime: {InvokeModel}

bedrock-runtime_InvokeModel_MetaLlama2:
title: Invoke Meta Llama 2 on &BR; using the Invoke Model API
title_abbrev: "InvokeModel: Llama 2"
synopsis: send a text message to Meta Llama 2, using the Invoke Model API.
category: Meta Llama
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_MetaLlama2
.NET:
versions:
- sdk_version: 3
github: dotnetv3/Bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message.
snippet_tags:
- BedrockRuntime.dotnetv3.InvokeModel_MetaLlama2
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_MetaLlama2
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.InvokeLlama2
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message.
snippet_tags:
- javascript.v3.bedrock-runtime.InvokeModel_Llama2_Quickstart
PHP:
versions:
- sdk_version: 3
github: php/example_code/bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message.
snippet_tags:
- php.example_code.bedrock-runtime.service.invokeLlama2
services:
bedrock-runtime: {InvokeModel}

bedrock-runtime_InvokeModel_MetaLlama3:
title: Invoke Meta Llama 3 on &BR; using the Invoke Model API
title_abbrev: "InvokeModel: Llama 3"
Expand Down Expand Up @@ -1055,47 +997,6 @@ bedrock-runtime_InvokeModelWithResponseStream_CohereCommandR:
services:
bedrock-runtime: {InvokeModel}

bedrock-runtime_InvokeModelWithResponseStream_MetaLlama2:
title: Invoke Meta Llama 2 on &BR; using the Invoke Model API with a response stream
title_abbrev: "InvokeModelWithResponseStream: Llama 2"
synopsis: send a text message to Meta Llama 2, using the Invoke Model API, and print the response stream.
category: Meta Llama
languages:
Java:
versions:
- sdk_version: 2
github: javav2/example_code/bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message and process the response stream in real-time.
snippet_tags:
- bedrock-runtime.java2.InvokeModelWithResponseStream_MetaLlama2
.NET:
versions:
- sdk_version: 3
github: dotnetv3/Bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message and process the response stream in real-time.
snippet_tags:
- BedrockRuntime.dotnetv3.InvokeModelWithResponseStream_MetaLlama2
Python:
versions:
- sdk_version: 3
github: python/example_code/bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message and process the response stream in real-time.
snippet_tags:
- python.example_code.bedrock-runtime.InvokeModelWithResponseStream_MetaLlama2
JavaScript:
versions:
- sdk_version: 3
github: javascriptv3/example_code/bedrock-runtime
excerpts:
- description: Use the Invoke Model API to send a text message and process the response stream in real-time.
snippet_tags:
- javascript.v3.bedrock-runtime.InvokeModelWithResponseStream_Llama2_Quickstart
services:
bedrock-runtime: {InvokeModelWithResponseStream}

bedrock-runtime_InvokeModelWithResponseStream_MetaLlama3:
title: Invoke Meta Llama 3 on &BR; using the Invoke Model API with a response stream
title_abbrev: "InvokeModelWithResponseStream: Llama 3"
Expand Down
56 changes: 0 additions & 56 deletions dotnetv3/Bedrock-runtime/Actions/InvokeModelAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,62 +218,6 @@ public static async Task<string> InvokeJurassic2Async(string prompt)

// snippet-end:[BedrockRuntime.dotnetv3.BedrockRuntimeActions.InvokeModelAsync.Jurassic2]

// snippet-start:[BedrockRuntime.dotnetv3.BedrockRuntimeActions.InvokeModelAsync.Llama2]

/// <summary>
/// Asynchronously invokes the Meta Llama 2 Chat model to run an inference based on the provided input.
/// </summary>
/// <param name="prompt">The prompt that you want Llama 2 to complete.</param>
/// <returns>The inference response from the model</returns>
/// <remarks>
/// The different model providers have individual request and response formats.
/// For the format, ranges, and default values for Meta Llama 2 Chat, refer to:
/// https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html
/// </remarks>
public static async Task<string> InvokeLlama2Async(string prompt)
{
string llama2ModelId = "meta.llama2-13b-chat-v1";

AmazonBedrockRuntimeClient client = new(RegionEndpoint.USEast1);

string payload = new JsonObject()
{
{ "prompt", prompt },
{ "max_gen_len", 512 },
{ "temperature", 0.5 },
{ "top_p", 0.9 }
}.ToJsonString();

string generatedText = "";
try
{
InvokeModelResponse response = await client.InvokeModelAsync(new InvokeModelRequest()
{
ModelId = llama2ModelId,
Body = AWSSDKUtils.GenerateMemoryStreamFromString(payload),
ContentType = "application/json",
Accept = "application/json"
});

if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
{
return JsonNode.ParseAsync(response.Body)
.Result?["generation"]?.GetValue<string>() ?? "";
}
else
{
Console.WriteLine("InvokeModelAsync failed with status code " + response.HttpStatusCode);
}
}
catch (AmazonBedrockRuntimeException e)
{
Console.WriteLine(e.Message);
}
return generatedText;
}

// snippet-end:[BedrockRuntime.dotnetv3.BedrockRuntimeActions.InvokeModelAsync.Llama2]

// snippet-start:[BedrockRuntime.dotnetv3.BedrockRuntimeActions.InvokeModelAsync.TitanTextG1]

/// <summary>
Expand Down
17 changes: 0 additions & 17 deletions dotnetv3/Bedrock-runtime/BedrockRuntimeExamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test
{02823466-F5FF-43A2-B70A-EF3482A0CBDD} = {02823466-F5FF-43A2-B70A-EF3482A0CBDD}
{0574B2F4-D4BE-4155-902B-BF3D7CE4804E} = {0574B2F4-D4BE-4155-902B-BF3D7CE4804E}
{1E62D4FB-CC59-4F1E-BB22-574CEC08C94B} = {1E62D4FB-CC59-4F1E-BB22-574CEC08C94B}
{25DD40DB-953F-4AA4-A273-28848BAFFBD8} = {25DD40DB-953F-4AA4-A273-28848BAFFBD8}
{2A6989CB-B273-4841-BD3E-7B1BBA4DD25F} = {2A6989CB-B273-4841-BD3E-7B1BBA4DD25F}
{3D6441FC-0FE8-4D0C-910D-3D9310599C71} = {3D6441FC-0FE8-4D0C-910D-3D9310599C71}
{4B5A00D6-B9F1-449F-A9D2-80E860D6BD75} = {4B5A00D6-B9F1-449F-A9D2-80E860D6BD75}
Expand All @@ -23,7 +22,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BedrockRuntimeTests", "Test
{B6924BBB-9993-44C1-BEF9-DEDEA42A12B2} = {B6924BBB-9993-44C1-BEF9-DEDEA42A12B2}
{B753CEB9-EA53-4AE1-997E-B7D54A299D58} = {B753CEB9-EA53-4AE1-997E-B7D54A299D58}
{BCC66C37-4980-484F-819D-066D2FF2669C} = {BCC66C37-4980-484F-819D-066D2FF2669C}
{C9049A40-6C4A-4071-9753-493FEB0C08BE} = {C9049A40-6C4A-4071-9753-493FEB0C08BE}
{CDF1A045-0888-418C-8656-2BF5E3348A48} = {CDF1A045-0888-418C-8656-2BF5E3348A48}
{D1B0719F-4F84-4DBC-BCAD-E856FB3193D7} = {D1B0719F-4F84-4DBC-BCAD-E856FB3193D7}
{D3BA31F5-FF20-4321-9494-3F01439C4F61} = {D3BA31F5-FF20-4321-9494-3F01439C4F61}
Expand Down Expand Up @@ -80,8 +78,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModel", "Models\Mistr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Llama3_InvokeModel", "Models\MetaLlama\Llama3_InvokeModel\Llama3_InvokeModel.csproj", "{B753CEB9-EA53-4AE1-997E-B7D54A299D58}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Llama2_InvokeModel", "Models\MetaLlama\Llama2_InvokeModel\Llama2_InvokeModel.csproj", "{25DD40DB-953F-4AA4-A273-28848BAFFBD8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Command_InvokeModel", "Models\CohereCommand\Command_InvokeModel\Command_InvokeModel.csproj", "{2A6989CB-B273-4841-BD3E-7B1BBA4DD25F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Command_R_InvokeModel", "Models\CohereCommand\Command_R_InvokeModel\Command_R_InvokeModel.csproj", "{BCC66C37-4980-484F-819D-066D2FF2669C}"
Expand All @@ -92,8 +88,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Command_InvokeModelWithResp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Command_R_InvokeModelWithResponseStream", "Models\CohereCommand\Command_R_InvokeModelWithResponseStream\Command_R_InvokeModelWithResponseStream.csproj", "{02823466-F5FF-43A2-B70A-EF3482A0CBDD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Llama2_InvokeModelWithResponseStream", "Models\MetaLlama\Llama2_InvokeModelWithResponseStream\Llama2_InvokeModelWithResponseStream.csproj", "{C9049A40-6C4A-4071-9753-493FEB0C08BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Llama3_InvokeModelWithResponseStream", "Models\MetaLlama\Llama3_InvokeModelWithResponseStream\Llama3_InvokeModelWithResponseStream.csproj", "{4B5A00D6-B9F1-449F-A9D2-80E860D6BD75}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InvokeModelWithResponseStream", "Models\Mistral\InvokeModelWithResponseStream\InvokeModelWithResponseStream.csproj", "{EFC7D088-EF45-464B-97CD-0BBA486B224A}"
Expand Down Expand Up @@ -174,10 +168,6 @@ Global
{B753CEB9-EA53-4AE1-997E-B7D54A299D58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B753CEB9-EA53-4AE1-997E-B7D54A299D58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B753CEB9-EA53-4AE1-997E-B7D54A299D58}.Release|Any CPU.Build.0 = Release|Any CPU
{25DD40DB-953F-4AA4-A273-28848BAFFBD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25DD40DB-953F-4AA4-A273-28848BAFFBD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25DD40DB-953F-4AA4-A273-28848BAFFBD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25DD40DB-953F-4AA4-A273-28848BAFFBD8}.Release|Any CPU.Build.0 = Release|Any CPU
{2A6989CB-B273-4841-BD3E-7B1BBA4DD25F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A6989CB-B273-4841-BD3E-7B1BBA4DD25F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A6989CB-B273-4841-BD3E-7B1BBA4DD25F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -198,10 +188,6 @@ Global
{02823466-F5FF-43A2-B70A-EF3482A0CBDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02823466-F5FF-43A2-B70A-EF3482A0CBDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02823466-F5FF-43A2-B70A-EF3482A0CBDD}.Release|Any CPU.Build.0 = Release|Any CPU
{C9049A40-6C4A-4071-9753-493FEB0C08BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9049A40-6C4A-4071-9753-493FEB0C08BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9049A40-6C4A-4071-9753-493FEB0C08BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9049A40-6C4A-4071-9753-493FEB0C08BE}.Release|Any CPU.Build.0 = Release|Any CPU
{4B5A00D6-B9F1-449F-A9D2-80E860D6BD75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B5A00D6-B9F1-449F-A9D2-80E860D6BD75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B5A00D6-B9F1-449F-A9D2-80E860D6BD75}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -241,14 +227,11 @@ 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}
{25DD40DB-953F-4AA4-A273-28848BAFFBD8} = {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}
{63984664-8230-40F3-BFF5-7AC4988D7FE7} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C}
{02823466-F5FF-43A2-B70A-EF3482A0CBDD} = {EF45C0B9-ED76-4B7A-A0A7-F102E979B71C}
{C9049A40-6C4A-4071-9753-493FEB0C08BE} = {65504C76-7E32-4A12-A42E-BCDA4FE79BC1}
{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}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading