Signed-off-by: Alexander Trauzzi <acj@trauzzi.me>
This commit is contained in:
Alexander Trauzzi 2025-09-02 10:21:39 -05:00
parent d2cfaca0fe
commit d525041729
3 changed files with 13 additions and 12 deletions

View File

@ -25,7 +25,6 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDaprConversationClient();
var app = builder.Build();
//Instantiate Dapr Conversation Client
var conversationClient = app.Services.GetRequiredService<DaprConversationClient>();
var conversationOptions = new ConversationOptions(conversationComponentName);
@ -41,7 +40,7 @@ var inputs = new ConversationInput(new List<IConversationMessage>
// Send a request to the echo mock LLM component
var response = await conversationClient.ConverseAsync([inputs], conversationOptions);
Console.WriteLine("Input sent: " + prompt);
Console.WriteLine($"Input sent: {prompt}");
Console.Write("Output response:");
@ -67,17 +66,18 @@ foreach (var output in response.Outputs)
// note: Alternative, for the LINQ inclined.
// response.Outputs
// .SelectMany((output) => output.Choices
// .SelectMany((choice) => choice.Message.ToolCalls
// .Select((toolCall) => ( Output: output, Choice: choice, ToolCall: toolCall) )))
// .SelectMany((output) => output.Choices)
// .ToList()
// .ForEach((entry) =>
// .ForEach((choice) =>
// {
// Console.WriteLine($" {entry.Choice.Message}");
//
// Console.WriteLine(entry switch
// Console.WriteLine($" {choice.Message}");
//
// choice.Message.ToolCalls.ToList().ForEach((toolCall) =>
// {
// (_, _, CalledToolFunction calledToolFunction) => $"\t\tId: {calledToolFunction.Id}, Name: {calledToolFunction.Name}, Arguments: {calledToolFunction.JsonArguments}",
// _ => $"\t\tId: {entry.ToolCall.Id}",
// Console.WriteLine(toolCall switch
// {
// CalledToolFunction calledToolFunction => $"\t\tId: {calledToolFunction.Id}, Name: {calledToolFunction.Name}, Arguments: {calledToolFunction.JsonArguments}",
// _ => $"\t\tId: {toolCall.Id}",
// });
// });
// });

View File

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapr.AI" Version="1.16.0-rc15" />
<PackageReference Include="Dapr.AI" Version="1.16.0-rc16" />
</ItemGroup>
</Project>

View File

@ -5,4 +5,5 @@ apps:
- appDirPath: ./conversation/
appID: conversation
daprHTTPPort: 3500
daprGRPCPort: 50001
command: ["dotnet", "run"]