Skip to content

Commit

Permalink
Fix Choice.Content => Choice.Message
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub committed Oct 17, 2024
1 parent 41e7383 commit 4594124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ private void LogChatCompletion(ChatCompletion completion)
{
FinishReason = completion.FinishReason?.Value ?? "error",
Index = choiceIndex,
Content = CreateAssistantEvent(completion.Choices[choiceIndex]),
Message = CreateAssistantEvent(completion.Choices[choiceIndex]),
}, OtelContext.Default.ChoiceEvent));
}
}
Expand Down Expand Up @@ -577,7 +577,7 @@ private sealed class ChoiceEvent
{
public string? FinishReason { get; set; }
public int Index { get; set; }
public AssistantEvent? Content { get; set; }
public AssistantEvent? Message { get; set; }
}

private sealed class ToolCall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async static IAsyncEnumerable<StreamingChatCompletionUpdate> CallbackAsync(
log => Assert.Equal("""{"id":"12345","content":"John"}""", log.Message),
log => Assert.Equal("""{"content":"Hey John, what\u0027s up?"}""", log.Message),
log => Assert.Equal("""{"content":"What\u0027s the biggest animal?"}""", log.Message),
log => Assert.Equal("""{"finish_reason":"stop","index":0,"content":{"content":"The blue whale, I think."}}""", log.Message));
log => Assert.Equal("""{"finish_reason":"stop","index":0,"message":{"content":"The blue whale, I think."}}""", log.Message));
}
else
{
Expand All @@ -178,7 +178,7 @@ async static IAsyncEnumerable<StreamingChatCompletionUpdate> CallbackAsync(
log => Assert.Equal("""{"id":"12345"}""", log.Message),
log => Assert.Equal("""{}""", log.Message),
log => Assert.Equal("""{}""", log.Message),
log => Assert.Equal("""{"finish_reason":"stop","index":0,"content":{}}""", log.Message));
log => Assert.Equal("""{"finish_reason":"stop","index":0,"message":{}}""", log.Message));
}

Assert.Collection(logs,
Expand Down

0 comments on commit 4594124

Please sign in to comment.