mirror of https://github.com/dapr/quickstarts.git
parent
d2cfaca0fe
commit
d525041729
|
|
@ -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}",
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -5,4 +5,5 @@ apps:
|
|||
- appDirPath: ./conversation/
|
||||
appID: conversation
|
||||
daprHTTPPort: 3500
|
||||
daprGRPCPort: 50001
|
||||
command: ["dotnet", "run"]
|
||||
Loading…
Reference in New Issue