tests: add missing tests for streaming chat message

This commit is contained in:
Stevan Freeborn
2024-06-29 22:07:49 -05:00
parent 77ceb49c77
commit 5edc0b5fff
16 changed files with 1183 additions and 7 deletions
+8 -1
View File
@@ -172,6 +172,13 @@ public class AnthropicApiClient : IAnthropicApiClient
chatResponse is not null
)
{
var existingUsage = chatResponse.Usage;
var newUsage = new ChatUsage()
{
InputTokens = existingUsage.InputTokens + msgDeltaData.Usage.InputTokens,
OutputTokens = existingUsage.OutputTokens + msgDeltaData.Usage.OutputTokens,
};
chatResponse = new ChatResponse()
{
Id = chatResponse.Id,
@@ -180,7 +187,7 @@ public class AnthropicApiClient : IAnthropicApiClient
StopReason = msgDeltaData.Delta.StopReason,
StopSequence = msgDeltaData.Delta.StopSequence,
Type = chatResponse.Type,
Usage = msgDeltaData.Usage,
Usage = newUsage,
Content = chatResponse.Content,
};
}