Skip to content

Commit

Permalink
update readme for streaming accuracy and explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
trrwilson committed Jan 17, 2025
1 parent 3670e3d commit 20a0f9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,12 @@ completion = client.CompleteChat(messages, options);
PrintAudioContent();
```

Streaming is virtually identical: items in `StreamingChatCompletionUpdate.ContentUpdate` will provide incremental chunks of data via
`AudioBytes` and `AudioTranscript`.
Streaming is highly parallel: `StreamingChatCompletionUpdate` instances can include a `ResponseAudioUpdate` that may
contain any of:

- The `Id` of the streamed audio content, which can be referenced by subsequent `AssistantChatMessage` instances via `ChatAudioReference` once the streaming response is complete; this may appear across multiple `StreamingChatCompletionUpdate` instances but will always be the same value when present
- The `ExpiresAt` value that describes when the `Id` will no longer be valid for use with `ChatAudioReference` in subsequent requests; this typically appears once and only once, in the final `StreamingResponseAudioUpdate`
- Incremental `TranscriptUpdate` and/or `DataUpdate` values, which can incrementally consumed and, when concatenated, form the complete audio transcript and audio output for the overall response; many of these typically appear

## How to generate text embeddings

Expand Down
2 changes: 1 addition & 1 deletion .dotnet/tests/Chat/ChatTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public async Task ChatWithAudio()
if (responseAudioUpdate.Id is not null)
{
Assert.That(streamedCorrelationId, Is.Null.Or.EqualTo(streamedCorrelationId));
streamedCorrelationId = responseAudioUpdate.Id;
streamedCorrelationId ??= responseAudioUpdate.Id;
}
if (responseAudioUpdate.ExpiresAt.HasValue)
{
Expand Down

0 comments on commit 20a0f9c

Please sign in to comment.