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
2 changes: 2 additions & 0 deletions dotnetv4/Bedrock-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.vs/
/Tools/
14 changes: 14 additions & 0 deletions dotnetv4/Bedrock-runtime/Actions/BedrockRuntimeActions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.BedrockRuntime" Version="4.0.0-preview.4" />
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions dotnetv4/Bedrock-runtime/Actions/HelloBedrockRuntime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

namespace BedrockRuntimeActions
{
internal class HelloBedrockRuntime
{
private static readonly string CLAUDE = "anthropic.claude-v2";

static async Task Main(string[] args)
{
await TextToText();
}

private static async Task TextToText()
{
string prompt = "In one sentence, what is a large-language model?";
await Invoke(CLAUDE, prompt);
}

private static async Task Invoke(string modelId, string prompt)
{
switch (modelId)
{
case var _ when modelId == CLAUDE:
Console.WriteLine(await InvokeModelAsync.InvokeClaudeAsync(prompt));
break;
default:
Console.WriteLine($"Unknown model ID: {modelId}. Valid model IDs are: {CLAUDE}.");
break;
};
}
}
}
Loading
Loading