openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.2.0-beta.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Assistants/Streaming/MessageStatusUpdate.cs

29lines · modecode

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