Skip to content

Commit 82c4588

Browse files
Re-targeted framework to .NET 6.0 for tests. Re-targeted framework to NET Standard 2.1 for library.
Fixed warnings. Removed superfluous references. Added required references.
1 parent 8bc534b commit 82c4588

File tree

7 files changed

+31
-10
lines changed

7 files changed

+31
-10
lines changed

OpenAI_API.sln.DotSettings

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=logprobs/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

OpenAI_API/Chat/ChatRequest.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using Newtonsoft.Json;
2-
using System;
32
using System.Collections.Generic;
43
using System.Linq;
5-
using System.Text;
4+
using OpenAI_API.Completions;
65

76
namespace OpenAI_API.Chat
87
{
@@ -16,7 +15,7 @@ public class ChatRequest
1615
/// The model to use for this request
1716
/// </summary>
1817
[JsonProperty("model")]
19-
public string Model { get; set; } = OpenAI_API.Models.Model.ChatGPTTurbo;
18+
public string Model { get; set; } = Models.Model.ChatGPTTurbo;
2019

2120
/// <summary>
2221
/// The messages to send with this Chat Request
@@ -46,7 +45,7 @@ public class ChatRequest
4645
/// Specifies where the results should stream and be returned at one time. Do not set this yourself, use the appropriate methods on <see cref="CompletionEndpoint"/> instead.
4746
/// </summary>
4847
[JsonProperty("stream")]
49-
public bool Stream { get; internal set; } = false;
48+
public bool Stream { get; internal set; }
5049

5150
/// <summary>
5251
/// This is only used for serializing the request into JSON, do not use it directly.
@@ -77,7 +76,7 @@ internal object CompiledStop
7776
[JsonIgnore]
7877
public string StopSequence
7978
{
80-
get => MultipleStopSequences?.FirstOrDefault() ?? null;
79+
get => MultipleStopSequences?.FirstOrDefault();
8180
set
8281
{
8382
if (value != null)

OpenAI_API/Completions/CompletionResult.cs

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Newtonsoft.Json;
2-
using OpenAI_API.Embedding;
32
using System.Collections.Generic;
43

54
namespace OpenAI_API.Completions
@@ -89,18 +88,32 @@ public override string ToString()
8988
}
9089
}
9190

92-
91+
/// <summary>
92+
/// Represents the logprobs property of a completion choice
93+
/// </summary>
9394
public class Logprobs
9495
{
96+
/// <summary>
97+
/// The tokens that were used to generate the completion
98+
/// </summary>
9599
[JsonProperty("tokens")]
96100
public List<string> Tokens { get; set; }
97101

102+
/// <summary>
103+
/// The log probabilities of each token
104+
/// </summary>
98105
[JsonProperty("token_logprobs")]
99106
public List<double?> TokenLogprobs { get; set; }
100107

108+
/// <summary>
109+
/// The top log probabilities for each token
110+
/// </summary>
101111
[JsonProperty("top_logprobs")]
102112
public IList<IDictionary<string, double>> TopLogprobs { get; set; }
103113

114+
/// <summary>
115+
/// The token ids of the tokens
116+
/// </summary>
104117
[JsonProperty("text_offset")]
105118
public List<int> TextOffsets { get; set; }
106119
}

OpenAI_API/Files/IFilesEndpoint.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Net.Http;
23
using System.Threading.Tasks;
34

45
namespace OpenAI_API.Files
@@ -40,7 +41,7 @@ public interface IFilesEndpoint
4041
/// Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact OpenAI if you need to increase the storage limit
4142
/// </summary>
4243
/// <param name="filePath">The name of the file to use for this request</param>
43-
/// <param name="purpose">The intendend purpose of the uploaded documents. Use "fine-tune" for Fine-tuning. This allows us to validate the format of the uploaded file.</param>
44+
/// <param name="purpose">The intended purpose of the uploaded documents. Use "fine-tune" for Fine-tuning. This allows us to validate the format of the uploaded file.</param>
4445
Task<File> UploadFileAsync(string filePath, string purpose = "fine-tune");
4546
}
4647
}

OpenAI_API/Model/Model.cs

+6
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ public class Permissions
230230
[JsonProperty("allow_search_indices")]
231231
public bool AllowSearchIndices { get; set; }
232232

233+
/// <summary>
234+
/// Does the model allow viewing?
235+
/// </summary>
233236
[JsonProperty("allow_view")]
234237
public bool AllowView { get; set; }
235238

@@ -252,6 +255,9 @@ public class Permissions
252255
[JsonProperty("group")]
253256
public string Group { get; set; }
254257

258+
/// <summary>
259+
/// Is the model allowed to be used for blocking? May not be implemented yet.
260+
/// </summary>
255261
[JsonProperty("is_blocking")]
256262
public bool IsBlocking { get; set; }
257263
}

OpenAI_API/OpenAI_API.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>netstandard2.1</TargetFramework>
55
<LangVersion>8.0</LangVersion>
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
77
<Authors>OkGoDoIt (Roger Pincombe)</Authors>

OpenAI_Tests/OpenAI_Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

0 commit comments

Comments
 (0)