openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Custom/Assistants/Streaming/MessageStatusUpdate.cs

27lines · modecode

1using System.ClientModel.Primitives;
2using System.Collections.Generic;
3using System.Text.Json;
4
5namespace OpenAI.Assistants;
6
7/// <summary>
8/// The update type presented when the status of a message changes.
9/// </summary>
10public class MessageStatusUpdate : StreamingUpdate<ThreadMessage>
11{
12 internal MessageStatusUpdate(ThreadMessage message, StreamingUpdateReason updateKind)
13 : base(message, updateKind)
14 { }
15
16 internal static IEnumerable<MessageStatusUpdate> DeserializeMessageStatusUpdates(
17 JsonElement element,
18 StreamingUpdateReason updateKind,
19 ModelReaderWriterOptions options = null)
20 {
21 ThreadMessage message = ThreadMessage.DeserializeThreadMessage(element, options);
22 return updateKind switch
23 {
24 _ => [new MessageStatusUpdate(message, updateKind)],
25 };
26 }
27}