Skip to content

Commit

Permalink
feat: Updated TargetFrameworks.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jul 10, 2024
1 parent 0c73778 commit 96fd223
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 10 deletions.
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
2 changes: 1 addition & 1 deletion src/libs/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<PropertyGroup Label="Nuget">
<Version>2.0.2</Version>
<Version>2.0.3</Version>
<Description>The fastest tokenizer for GPT-3.5 and GPT-4 inspired by Tiktoken.</Description>
<PackageTags>chatgpt;openai;tiktoken;tokens;gpt-4;gpt-3.5-turbo;cl100k_base;p50k_base</PackageTags>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Tiktoken.Core/Tiktoken.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);CA1724</NoWarn>
<RootNamespace>Tiktoken</RootNamespace>
Expand All @@ -20,7 +20,7 @@
<EmbeddedResource Include="Encodings/*.tiktoken" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net4.6.1'">
<ItemGroup Condition="'$(TargetFramework)' == 'net4.6.2'">
<PackageReference Include="System.ValueTuple" />
</ItemGroup>

Expand Down
25 changes: 24 additions & 1 deletion src/libs/Tiktoken.Encodings.Abstractions/EncodingLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,31 @@ public static Dictionary<byte[], int> LoadEncodingFromManifestResource(
throw new InvalidOperationException("Resource not found.");
using var reader = new StreamReader(stream);

var dictionary = new Dictionary<byte[], int>(new ByteArrayComparer());
var lines = new List<string>();
while (reader.ReadLine() is { } line)
{
lines.Add(line);
}

return LoadEncodingFromLines(lines, name);
}

/// <summary>
///
/// </summary>
/// <param name="lines"></param>
/// <param name="name"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
/// <exception cref="FormatException"></exception>
public static Dictionary<byte[], int> LoadEncodingFromLines(
this IReadOnlyList<string> lines,
string name)
{
lines = lines ?? throw new ArgumentNullException(nameof(lines));

var dictionary = new Dictionary<byte[], int>(new ByteArrayComparer());
foreach (var line in lines)
{
if (string.IsNullOrWhiteSpace(line))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<RootNamespace>Tiktoken.Encodings</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<RootNamespace>Tiktoken.Encodings</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<RootNamespace>Tiktoken.Encodings</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<RootNamespace>Tiktoken.Encodings</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<RootNamespace>Tiktoken.Encodings</RootNamespace>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/libs/Tiktoken/Tiktoken.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net4.6.1;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net4.6.2;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 96fd223

Please sign in to comment.