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/RunUpdate.cs

28lines · 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 <see cref="ThreadRun"/> has changed.
10/// </summary>
11[Experimental("OPENAI001")]
12public class RunUpdate : StreamingUpdate<ThreadRun>
13{
14 internal RunUpdate(ThreadRun run, StreamingUpdateReason updateKind) : base(run, updateKind)
15 { }
16
17 internal static IEnumerable<StreamingUpdate<ThreadRun>> DeserializeRunUpdates(
18 JsonElement element,
19 StreamingUpdateReason updateKind,
20 ModelReaderWriterOptions options = null)
21 {
22 ThreadRun run = ThreadRun.DeserializeThreadRun(element, options);
23 return updateKind switch
24 {
25 _ => [new RunUpdate(run, updateKind)],
26 };
27 }
28}
29