openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Assistants/Streaming/RunStepUpdate.cs
29lines · modecode
| 1 | using System.ClientModel.Primitives; |
| 2 | using System.Collections.Generic; |
| 3 | using System.Diagnostics.CodeAnalysis; |
| 4 | using System.Text.Json; |
| 5 | |
| 6 | namespace OpenAI.Assistants; |
| 7 | |
| 8 | /// <summary> |
| 9 | /// The update type presented when the status of a run step changes. |
| 10 | /// </summary> |
| 11 | [Experimental("OPENAI001")] |
| 12 | public class RunStepUpdate : StreamingUpdate<RunStep> |
| 13 | { |
| 14 | internal RunStepUpdate(RunStep runStep, StreamingUpdateReason updateKind) |
| 15 | : base(runStep, updateKind) |
| 16 | { } |
| 17 | |
| 18 | internal static IEnumerable<StreamingUpdate<RunStep>> DeserializeRunStepUpdates( |
| 19 | JsonElement element, |
| 20 | StreamingUpdateReason updateKind, |
| 21 | ModelReaderWriterOptions options = null) |
| 22 | { |
| 23 | RunStep runStep = RunStep.DeserializeRunStep(element, options); |
| 24 | return updateKind switch |
| 25 | { |
| 26 | _ => [new RunStepUpdate(runStep, updateKind)], |
| 27 | }; |
| 28 | } |
| 29 | } |