Closed art-korn-39 closed 8 months ago
Thanks for the report, but we need more information. Can you please create a minimal reproducible example of the bad path you're observing? Is it something you see consistently for all queries, or just a specific one?
I have prepared an example. I used only one request text. The main thing is that the stream method always receives "resp.Candidates[0].Content = nil" in the last iteration, but if you pause for 1 second inside the loop, the error disappears. At shorter pause intervals it remains. Please check this moment.
The underlying problem is that something in your prompt triggered the model to generate some sort of protected (copyrighted) material, and that caused it to stop. Technically, the model returned a new FinishReason that we hadn't accounted for. The fix will prevent the panic, but your prompt will still result in an error.
I should add that I couldn't reproduce the change in behavior due to sleeping. I always got the same result.
Hello I noticed that the output results in the two methods are different. In this case, the normal method returns the full result, and the stream method performs 2-3 iterations and fails with an error (when resp.Candidates[0].Content = nil).
Example of initialization:
Please tell me, is this normal behavior or can I somehow fix it so that the capabilities of the streaming method are not inferior to the usual one?