From 9009a1d7b032387d9a5a55d2f1a853faa97ac574 Mon Sep 17 00:00:00 2001 From: Tolga Kayhan Date: Tue, 18 Jun 2024 11:38:53 +0100 Subject: [PATCH] Introduced IsDelta into BaseResponseModel, --- OpenAI.SDK/ObjectModels/ResponseModels/BaseResponse.cs | 2 ++ OpenAI.SDK/OpenAI.csproj | 2 +- Readme.md | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenAI.SDK/ObjectModels/ResponseModels/BaseResponse.cs b/OpenAI.SDK/ObjectModels/ResponseModels/BaseResponse.cs index 3273e0c1..403cfc91 100644 --- a/OpenAI.SDK/ObjectModels/ResponseModels/BaseResponse.cs +++ b/OpenAI.SDK/ObjectModels/ResponseModels/BaseResponse.cs @@ -14,6 +14,8 @@ public record BaseResponse: ObjectBaseResponse { [JsonPropertyName("StreamEvent")] public string? StreamEvent { get; set; } + public bool IsDelta => StreamEvent?.EndsWith("delta") ?? false; + public bool Successful => Error == null; [JsonPropertyName("error")] diff --git a/OpenAI.SDK/OpenAI.csproj b/OpenAI.SDK/OpenAI.csproj index 7b1f68bd..f2f18da4 100644 --- a/OpenAI.SDK/OpenAI.csproj +++ b/OpenAI.SDK/OpenAI.csproj @@ -10,7 +10,7 @@ OpenAI-Betalgo.png true OpenAI SDK by Betalgo - 8.5.0 + 8.5.1 Tolga Kayhan, Betalgo Betalgo Up Ltd. OpenAI ChatGPT, Whisper, GPT-4 and DALLĀ·E dotnet SDK diff --git a/Readme.md b/Readme.md index 6f866aac..9abf27e8 100644 --- a/Readme.md +++ b/Readme.md @@ -116,6 +116,9 @@ Due to time constraints, not all methods have been thoroughly tested or fully do Needless to say, I cannot accept responsibility for any damage caused by using the library. ## Changelog +### 8.5.1 +- Introduced `IsDelta` into BaseResponseModel, which can help to determine if incoming data is part of the delta. +- ### 8.5.0 - Assistant Stream now returns the `BaseResponse` type, but they can be cast to the appropriate types(`RunStepResponse`,`RunResponse`,`MessageResponse`). The reason for this change is that we realized the stream API returns multiple different object types rather than returning a single object type. - The Base Response now has a `StreamEvent` field, which can be used to determine the type of event while streaming.