Skip to content

Commit

Permalink
OpenAI-DotNet 7.4.0 (#194)
Browse files Browse the repository at this point in the history
- Refactored OpenAI.Threads.LastRunError -> OpenAI.Error for more generic use in future.
- Fixed OpenAI.Threads.Annotations namespace
- Fixed OpenAI.Threads.ContextText namespace
  • Loading branch information
StephenHodgson authored Nov 30, 2023
1 parent 929f45e commit 046bcf3
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Publish-Nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- run: dotnet restore

- run: dotnet build --configuration Release --no-restore

- name: Test Packages
if: ${{ github.ref != 'refs/heads/main' && github.event_name != 'push' }}
run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --logger:trx --no-build --no-restore --results-directory ./test-results
Expand Down
1 change: 0 additions & 1 deletion OpenAI-DotNet-Tests/TestFixture_08_Files.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Threading.Tasks;

namespace OpenAI.Tests
Expand Down
1 change: 0 additions & 1 deletion OpenAI-DotNet-Tests/TestFixture_09_FineTuning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;

namespace OpenAI.Tests
Expand Down
2 changes: 1 addition & 1 deletion OpenAI-DotNet-Tests/TestFixture_11_Assistants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace OpenAI.Tests
{
internal class TestFixture_11_Assistants : AbstractTestFixture
{
private static AssistantResponse testAssistant;
private AssistantResponse testAssistant;

[Test]
public async Task Test_01_CreateAssistant()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Text.Json.Serialization;

namespace OpenAI.Threads
namespace OpenAI
{
public sealed class RunLastError
public sealed class Error
{
/// <summary>
/// One of server_error or rate_limit_exceeded.
Expand Down
8 changes: 6 additions & 2 deletions OpenAI-DotNet/OpenAI-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
<RepositoryUrl>https://github.com/RageAgainstThePixel/OpenAI-DotNet</RepositoryUrl>
<PackageTags>OpenAI, AI, ML, API, gpt-4, gpt-3.5-tubo, gpt-3, chatGPT, chat-gpt, gpt-2, gpt, dall-e-2, dall-e-3</PackageTags>
<Title>OpenAI-DotNet</Title>
<Version>7.3.8</Version>
<PackageReleaseNotes>Version 7.3.8
<Version>7.4.0</Version>
<PackageReleaseNotes>Version 7.4.0
- Refactored OpenAI.Threads.LastRunError -&gt; OpenAI.Error for more generic use in future.
- Fixed OpenAI.Threads.Annotations namespace
- Fixed OpenAI.Threads.ContextText namespace
Version 7.3.8
- Added Chat.Content.ctr overloads and implicit casting for easier usage
- Internal refactoring of FilesEndpoint.DeleteFileAsync (better status checking)
- Internal refactoring of FineTuningEndpoint to ensure we're properly setting response data
Expand Down
3 changes: 1 addition & 2 deletions OpenAI-DotNet/Threads/Annotation.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using OpenAI.Extensions;
using OpenAI.Threads;
using System.Text.Json.Serialization;

namespace OpenAI
namespace OpenAI.Threads
{
public sealed class Annotation
{
Expand Down
4 changes: 2 additions & 2 deletions OpenAI-DotNet/Threads/ContentText.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace OpenAI
namespace OpenAI.Threads
{
public sealed class ContentText
{
Expand All @@ -15,7 +15,7 @@ public sealed class ContentText
public string Value { get; private set; }

/// <summary>
/// Annotations
/// Annotations.
/// </summary>
[JsonInclude]
[JsonPropertyName("annotations")]
Expand Down
1 change: 1 addition & 0 deletions OpenAI-DotNet/Threads/MessageFileResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public sealed class MessageFileResponse : BaseResponse
[JsonPropertyName("created_at")]
public int CreatedAtUnixTimeSeconds { get; private set; }

[JsonIgnore]
public DateTime CreatedAt => DateTimeOffset.FromUnixTimeSeconds(CreatedAtUnixTimeSeconds).DateTime;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion OpenAI-DotNet/Threads/MessageResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ public sealed class MessageResponse : BaseResponse
/// putting each item on a new line.
/// </summary>
/// <returns><see cref="string"/> of all <see cref="Content"/>.</returns>
public string PrintContent() => string.Join("\n", Content.Select(content => content.ToString()));
public string PrintContent() => string.Join("\n", Content.Select(content => content?.ToString()));
}
}
2 changes: 1 addition & 1 deletion OpenAI-DotNet/Threads/RunResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public sealed class RunResponse : BaseResponse
/// </summary>
[JsonInclude]
[JsonPropertyName("last_error")]
public RunLastError LastError { get; private set; }
public Error LastError { get; private set; }

/// <summary>
/// The Unix timestamp (in seconds) for when the thread was created.
Expand Down
2 changes: 1 addition & 1 deletion OpenAI-DotNet/Threads/RunStepResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public sealed class RunStepResponse : BaseResponse
/// </summary>
[JsonInclude]
[JsonPropertyName("last_error")]
public RunLastError LastError { get; private set; }
public Error LastError { get; private set; }

/// <summary>
/// The Unix timestamp (in seconds) for when the run step was created.
Expand Down

0 comments on commit 046bcf3

Please sign in to comment.