Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-targeted framework to .NET 6.0 for tests. #153

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions OpenAI_API.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<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">
<s:Boolean x:Key="/Default/UserDictionary/Words/=logprobs/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
9 changes: 4 additions & 5 deletions OpenAI_API/Chat/ChatRequest.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenAI_API.Completions;

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

/// <summary>
/// The messages to send with this Chat Request
Expand Down Expand Up @@ -46,7 +45,7 @@ public class ChatRequest
/// 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.
/// </summary>
[JsonProperty("stream")]
public bool Stream { get; internal set; } = false;
public bool Stream { get; internal set; }

/// <summary>
/// This is only used for serializing the request into JSON, do not use it directly.
Expand Down Expand Up @@ -77,7 +76,7 @@ internal object CompiledStop
[JsonIgnore]
public string StopSequence
{
get => MultipleStopSequences?.FirstOrDefault() ?? null;
get => MultipleStopSequences?.FirstOrDefault();
set
{
if (value != null)
Expand Down
17 changes: 15 additions & 2 deletions OpenAI_API/Completions/CompletionResult.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using OpenAI_API.Embedding;
using System.Collections.Generic;

namespace OpenAI_API.Completions
Expand Down Expand Up @@ -89,18 +88,32 @@ public override string ToString()
}
}


/// <summary>
/// Represents the logprobs property of a completion choice
/// </summary>
public class Logprobs
{
/// <summary>
/// The tokens that were used to generate the completion
/// </summary>
[JsonProperty("tokens")]
public List<string> Tokens { get; set; }

/// <summary>
/// The log probabilities of each token
/// </summary>
[JsonProperty("token_logprobs")]
public List<double?> TokenLogprobs { get; set; }

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

/// <summary>
/// The token ids of the tokens
/// </summary>
[JsonProperty("text_offset")]
public List<int> TextOffsets { get; set; }
}
Expand Down
3 changes: 2 additions & 1 deletion OpenAI_API/Files/IFilesEndpoint.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

namespace OpenAI_API.Files
Expand Down Expand Up @@ -40,7 +41,7 @@ public interface IFilesEndpoint
/// 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
/// </summary>
/// <param name="filePath">The name of the file to use for this request</param>
/// <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>
/// <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>
Task<File> UploadFileAsync(string filePath, string purpose = "fine-tune");
}
}
6 changes: 6 additions & 0 deletions OpenAI_API/Model/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ public class Permissions
[JsonProperty("allow_search_indices")]
public bool AllowSearchIndices { get; set; }

/// <summary>
/// Does the model allow viewing?
/// </summary>
[JsonProperty("allow_view")]
public bool AllowView { get; set; }

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

/// <summary>
/// Is the model allowed to be used for blocking? May not be implemented yet.
/// </summary>
[JsonProperty("is_blocking")]
public bool IsBlocking { get; set; }
}
Expand Down
2 changes: 1 addition & 1 deletion OpenAI_Tests/OpenAI_Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down