Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompletedResponseGenerated occurs twice #375

Closed
PankajRawat333 opened this issue Jul 11, 2024 · 1 comment
Closed

CompletedResponseGenerated occurs twice #375

PankajRawat333 opened this issue Jul 11, 2024 · 1 comment
Labels
bug Something isn't working question Further information is requested

Comments

@PankajRawat333
Copy link

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.

image

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

image

NuGet package version

0.15.0

Additional context

No response

@PankajRawat333 PankajRawat333 added the bug Something isn't working label Jul 11, 2024
@HavenDV HavenDV added the question Further information is requested label Jul 11, 2024
@HavenDV
Copy link
Contributor

HavenDV commented Jul 11, 2024

Thank you, this is indeed a mistake.
Fixed in latest preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants