CompletedResponseGenerated occurs twice
PankajRawat333 opened this issue · 1 comments
PankajRawat333 commented
Describe the bug
I want to perform some operations on the CompletedResponseGenerated events, but I noticed that this event occurs twice. When I was examining the source code, I couldn't understand why the OnCompletedResponseGenerated method is being called twice.
Help me understand if this behavior is expected?
Steps to reproduce the bug
static async Task Main(string[] args)
{
Console.WriteLine("Welcome to LangChain .NET");
var provider = new BedrockProvider(RegionEndpoint.USEast1);
var llm = new Claude3SonnetModel(provider)
{
Settings = new BedrockChatSettings
{
UseStreaming = true
}
};
llm.PromptSent += (_, prompt) => Console.WriteLine($"Prompt: {prompt}");
llm.PartialResponseGenerated += (_, delta) => Console.Write(delta);
llm.CompletedResponseGenerated += (_, prompt) => Console.WriteLine($"Completed response: {prompt}");
var prompt = @"
Who was the President of the United States in the year 2000? Just give me answer, no explaination";
var response = await llm.GenerateAsync(prompt);
Console.Read();
}
Expected behavior
No response
Screenshots
NuGet package version
0.15.0
Additional context
No response
HavenDV commented
Thank you, this is indeed a mistake.
Fixed in latest preview.