Describe the bug
when I use CreateCompletionAsStream() method,the response not include Usage object,but CreateCompletion() include.
Your code piece
var chatResponse=openAiService.ChatCompletion.CreateCompletionAsStream(new ChatCompletionCreateRequest
{
Messages = new List<ChatMessage>
{
ChatMessage.FromSystem("You are a helpful assistant."),
ChatMessage.FromUser(inputStr),
},
Model = Models.ChatGpt3_5Turbo
});
var tokens=0;
await foreach(var chat in chatResponse){
if (chat.Successful){
tokens+=chat.Usage?.TotalTokens ?? 0;
var choice=chat.Choices.First();
Console.Write(choice.Message.Content);
}
}
Result
chat.Usage is null
Expected behavior
chat.Usage is not null and inclue tokens.
Screenshots
the CreateCompletionAsStream()response
the CreateCompletion() response
Desktop (please complete the following information):
Describe the bug when I use CreateCompletionAsStream() method,the response not include Usage object,but CreateCompletion() include.
Your code piece
Result chat.Usage is null
Expected behavior chat.Usage is not null and inclue tokens.
Screenshots
the CreateCompletionAsStream()response![image](https://user-images.githubusercontent.com/998503/225813085-d33167c0-329d-4509-9fca-56a136464a66.png)
the CreateCompletion() response![image](https://user-images.githubusercontent.com/998503/225813411-419865c9-77f2-49ac-8660-99efa14f1c38.png)
Desktop (please complete the following information):