Skip to content

Commit

Permalink
fix: Fixed bug with local models. Updated packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Oct 12, 2023
1 parent 56822a7 commit 4c6ce7c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions LangChain.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{23506EB8-1
src\Directory.Packages.props = src\Directory.Packages.props
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
.github\workflows\pull-request.yml = .github\workflows\pull-request.yml
.github\dependabot.yml = .github\dependabot.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{EB6F52EE-7E7E-4624-A99E-79D3F190F386}"
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Anthropic" Version="0.3.0" />
<PackageVersion Include="Anyscale" Version="1.0.0" />
<PackageVersion Include="Anyscale" Version="1.0.1" />
<PackageVersion Include="Aspose.PDF" Version="23.9.0" />
<PackageVersion Include="AWSSDK.Kendra" Version="3.7.201.16" />
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.1.1" />
Expand Down Expand Up @@ -32,7 +32,7 @@
<PackageVersion Include="PolySharp" Version="1.13.2" />
<PackageVersion Include="System.Text.Json" Version="7.0.3" />
<PackageVersion Include="Tiktoken" Version="1.1.2" />
<PackageVersion Include="tryAGI.OpenAI" Version="1.8.0" />
<PackageVersion Include="tryAGI.OpenAI" Version="1.8.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<PropertyGroup Label="Nuget">
<Version>0.10.0</Version>
<Version>0.10.1</Version>
<PackageTags>langchain</PackageTags>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public AnyscaleModel(AnyscaleConfiguration configuration, HttpClient httpClient)
Id = configuration.ModelId ?? throw new ArgumentException("ModelId is not defined", nameof(configuration));
HttpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));

Encoding = Tiktoken.Encoding.ForModel(Id);
Encoding = Tiktoken.Encoding.TryForModel(Id) ?? Tiktoken.Encoding.Get(Tiktoken.Encodings.Cl100KBase);
Api = new AnyscaleApi(apiKey: ApiKey, HttpClient);
}

Expand All @@ -81,7 +81,7 @@ public AnyscaleModel(string apiKey, HttpClient httpClient, string id)
HttpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
Id = id ?? throw new ArgumentNullException(nameof(id));

Encoding = Tiktoken.Encoding.ForModel(Id);
Encoding = Tiktoken.Encoding.TryForModel(Id) ?? Tiktoken.Encoding.Get(Tiktoken.Encodings.Cl100KBase);
Api = new AnyscaleApi(apiKey: ApiKey, HttpClient);
}

Expand Down
4 changes: 2 additions & 2 deletions src/libs/Providers/LangChain.Providers.OpenAI/OpenAiModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public OpenAiModel(OpenAiConfiguration configuration, HttpClient httpClient)
EmbeddingModelId = configuration.EmbeddingModelId ?? throw new ArgumentException("EmbeddingModelId is not defined", nameof(configuration));
HttpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));

Encoding = Tiktoken.Encoding.ForModel(Id);
Encoding = Tiktoken.Encoding.TryForModel(Id) ?? Tiktoken.Encoding.Get(Tiktoken.Encodings.Cl100KBase);
Api = new OpenAiApi(apiKey: ApiKey, HttpClient);
if (configuration.Endpoint != null &&
!string.IsNullOrWhiteSpace(configuration.Endpoint))
Expand All @@ -87,7 +87,7 @@ public OpenAiModel(string apiKey, HttpClient httpClient, string id)
HttpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
Id = id ?? throw new ArgumentNullException(nameof(id));

Encoding = Tiktoken.Encoding.ForModel(Id);
Encoding = Tiktoken.Encoding.TryForModel(Id) ?? Tiktoken.Encoding.Get(Tiktoken.Encodings.Cl100KBase);
Api = new OpenAiApi(apiKey: ApiKey, HttpClient);
}

Expand Down

0 comments on commit 4c6ce7c

Please sign in to comment.