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

Updated Anthropic Provider #192

Merged
merged 21 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
30 changes: 22 additions & 8 deletions LangChain.sln
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Amazon.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Amazon.SageMaker.Tests", "src\Providers\Amazon.Sagemaker\test\LangChain.Providers.Amazon.SageMaker.Tests.csproj", "{08270801-B335-4DDE-8329-9D9198C3D3A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic", "src\Providers\Anthropic\src\LangChain.Providers.Anthropic.csproj", "{24D2455C-5429-4001-83D9-6E80B3134127}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anyscale", "src\Providers\Anyscale\src\LangChain.Providers.Anyscale.csproj", "{F9B5D1B9-3390-47B5-BE37-219B66E44F70}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Automatic1111", "src\Providers\Automatic1111\src\LangChain.Providers.Automatic1111.csproj", "{DA40F290-6B2D-451B-8BE2-9C577C4F1B11}"
Expand Down Expand Up @@ -280,7 +278,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.OpenRou
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.OpenRouter.Tests", "src\Providers\OpenRouter\tests\LangChain.Providers.OpenRouter.Tests.csproj", "{4C3A06A7-5603-426C-B57C-D34336679002}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LangChain.Providers.OpenRouter.CodeGenerator", "src\Providers\OpenRouter\tools\LangChain.Providers.OpenRouter.CodeGenerator\LangChain.Providers.OpenRouter.CodeGenerator.csproj", "{1BC041D3-F70D-4906-BA8F-49DB4FB7AEF0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.OpenRouter.CodeGenerator", "src\Providers\OpenRouter\tools\LangChain.Providers.OpenRouter.CodeGenerator\LangChain.Providers.OpenRouter.CodeGenerator.csproj", "{1BC041D3-F70D-4906-BA8F-49DB4FB7AEF0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic.Tests", "src\Providers\Anthropic\tests\LangChain.Providers.Anthropic.Tests.csproj", "{CAE7BB48-A6FF-41A5-A418-D34E18A1BC00}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic", "src\Providers\Anthropic\libs\Anthropic\LangChain.Providers.Anthropic.csproj", "{2FB02C8A-4537-401D-9DAB-171E8562EB6A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic.Generators", "src\Providers\Anthropic\libs\Anthropic.Generator\LangChain.Providers.Anthropic.Generators.csproj", "{358ACF7D-0859-4009-BFC3-1F3B6FE4BB86}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -344,10 +348,6 @@ Global
{08270801-B335-4DDE-8329-9D9198C3D3A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08270801-B335-4DDE-8329-9D9198C3D3A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08270801-B335-4DDE-8329-9D9198C3D3A1}.Release|Any CPU.Build.0 = Release|Any CPU
{24D2455C-5429-4001-83D9-6E80B3134127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24D2455C-5429-4001-83D9-6E80B3134127}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24D2455C-5429-4001-83D9-6E80B3134127}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24D2455C-5429-4001-83D9-6E80B3134127}.Release|Any CPU.Build.0 = Release|Any CPU
{F9B5D1B9-3390-47B5-BE37-219B66E44F70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9B5D1B9-3390-47B5-BE37-219B66E44F70}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9B5D1B9-3390-47B5-BE37-219B66E44F70}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -584,6 +584,18 @@ Global
{1BC041D3-F70D-4906-BA8F-49DB4FB7AEF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BC041D3-F70D-4906-BA8F-49DB4FB7AEF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BC041D3-F70D-4906-BA8F-49DB4FB7AEF0}.Release|Any CPU.Build.0 = Release|Any CPU
{CAE7BB48-A6FF-41A5-A418-D34E18A1BC00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAE7BB48-A6FF-41A5-A418-D34E18A1BC00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAE7BB48-A6FF-41A5-A418-D34E18A1BC00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAE7BB48-A6FF-41A5-A418-D34E18A1BC00}.Release|Any CPU.Build.0 = Release|Any CPU
{2FB02C8A-4537-401D-9DAB-171E8562EB6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FB02C8A-4537-401D-9DAB-171E8562EB6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FB02C8A-4537-401D-9DAB-171E8562EB6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FB02C8A-4537-401D-9DAB-171E8562EB6A}.Release|Any CPU.Build.0 = Release|Any CPU
{358ACF7D-0859-4009-BFC3-1F3B6FE4BB86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{358ACF7D-0859-4009-BFC3-1F3B6FE4BB86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{358ACF7D-0859-4009-BFC3-1F3B6FE4BB86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{358ACF7D-0859-4009-BFC3-1F3B6FE4BB86}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -616,7 +628,6 @@ Global
{10B7C532-327F-4424-85EE-A7D4E06E9976} = {96CCA968-1CE4-4DAB-9495-F8BA1249ADCD}
{08BA819F-538B-44A8-9463-3F90381F7F0D} = {96CCA968-1CE4-4DAB-9495-F8BA1249ADCD}
{08270801-B335-4DDE-8329-9D9198C3D3A1} = {96CCA968-1CE4-4DAB-9495-F8BA1249ADCD}
{24D2455C-5429-4001-83D9-6E80B3134127} = {7A2A589D-F8EF-4744-9BEE-B06A5F109851}
{F9B5D1B9-3390-47B5-BE37-219B66E44F70} = {B165FD5F-43B9-4A0C-A627-C4C94F6C027C}
{DA40F290-6B2D-451B-8BE2-9C577C4F1B11} = {0ACB8140-8198-4FA4-94DF-95A159E38E5C}
{4724E9F2-A344-4B64-9492-AD6A6964AF43} = {0ACB8140-8198-4FA4-94DF-95A159E38E5C}
Expand Down Expand Up @@ -699,6 +710,9 @@ Global
{A9442EA6-7567-4F1A-86E8-289DF51C9695} = {7FE91F38-E133-4F58-9852-BCB6A15A82D1}
{4C3A06A7-5603-426C-B57C-D34336679002} = {7FE91F38-E133-4F58-9852-BCB6A15A82D1}
{1BC041D3-F70D-4906-BA8F-49DB4FB7AEF0} = {7FE91F38-E133-4F58-9852-BCB6A15A82D1}
{CAE7BB48-A6FF-41A5-A418-D34E18A1BC00} = {7A2A589D-F8EF-4744-9BEE-B06A5F109851}
{2FB02C8A-4537-401D-9DAB-171E8562EB6A} = {7A2A589D-F8EF-4744-9BEE-B06A5F109851}
{358ACF7D-0859-4009-BFC3-1F3B6FE4BB86} = {7A2A589D-F8EF-4744-9BEE-B06A5F109851}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C00D0F1-6138-4ED9-846B-97E43D6DFF1C}
Expand Down
7 changes: 5 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ItemGroup>
<PackageVersion Include="AngleSharp" Version="1.1.0" />
<PackageVersion Include="Anthropic" Version="0.3.1" />
<PackageVersion Include="Anthropic.SDK" Version="2.0.1" />
<PackageVersion Include="Anyscale" Version="1.0.2" />
<PackageVersion Include="Aspose.PDF" Version="24.2.0" />
<PackageVersion Include="AWSSDK.BedrockRuntime" Version="3.7.301.43" />
Expand All @@ -17,13 +18,15 @@
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.1.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageVersion Include="Google_GenerativeAI" Version="0.1.18" />
<PackageVersion Include="Google_GenerativeAI" Version="0.1.19" />
<PackageVersion Include="H.Generators.Extensions" Version="1.22.0" />
<PackageVersion Include="H.Resources.Generator" Version="1.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="HtmlAgilityPack" Version="1.11.60" />
<PackageVersion Include="HuggingFace" Version="0.2.4" />
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
<PackageVersion Include="LeonardoAi" Version="0.1.0" />
<PackageVersion Include="LLamaSharp" Version="0.10.0" />
<PackageVersion Include="LLamaSharp.Backend.Cpu" Version="0.10.0" />
Expand Down Expand Up @@ -66,7 +69,7 @@
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="Tiktoken" Version="1.1.3" />
<PackageVersion Include="tryAGI.OpenAI" Version="2.0.2" />
<PackageVersion Include="tryAGI.OpenAI" Version="2.0.4" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Providers\Anthropic\src\LangChain.Providers.Anthropic.csproj" />
<ProjectReference Include="..\..\..\Providers\Anthropic\libs\Anthropic\LangChain.Providers.Anthropic.csproj" />
<ProjectReference Include="..\..\..\Providers\Anyscale\src\LangChain.Providers.Anyscale.csproj" />
<ProjectReference Include="..\..\..\Providers\HuggingFace\src\LangChain.Providers.HuggingFace.csproj" />
<ProjectReference Include="..\..\..\Providers\OpenAI\src\LangChain.Providers.OpenAI.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static IServiceCollection AddAnthropic(
_ = services
.AddScoped<AnthropicProvider>(static services => AnthropicProvider.FromConfiguration(
configuration: services.GetRequiredService<IOptions<AnthropicConfiguration>>().Value,
httpClient: services.GetRequiredService<HttpClient>()));
httpClientFactory: services.GetRequiredService<IHttpClientFactory>()));

return services;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Meta/src/LangChain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<ProjectReference Include="..\..\Core\src\LangChain.Core.csproj" />
<ProjectReference Include="..\..\Databases\InMemory\src\LangChain.Databases.InMemory.csproj" />
<ProjectReference Include="..\..\Extensions\DependencyInjection\src\LangChain.Extensions.DependencyInjection.csproj" />

HavenDV marked this conversation as resolved.
Show resolved Hide resolved
<ProjectReference Include="..\..\Providers\Anthropic\src\LangChain.Providers.Anthropic.csproj" />
<ProjectReference Include="..\..\Providers\Anthropic\libs\Anthropic\LangChain.Providers.Anthropic.csproj" />
<ProjectReference Include="..\..\Providers\Anyscale\src\LangChain.Providers.Anyscale.csproj" />
<ProjectReference Include="..\..\Providers\HuggingFace\src\LangChain.Providers.HuggingFace.csproj" />
<ProjectReference Include="..\..\Providers\OpenAI\src\LangChain.Providers.OpenAI.csproj" />
Expand Down
43 changes: 43 additions & 0 deletions src/Providers/Anthropic/Anthropic.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic.Tests", "tests\LangChain.Providers.Anthropic.Tests.csproj", "{4B06075D-EC7B-44F4-8C46-EFAF971FCDAC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{4FF98FFA-E401-4C16-8AA4-94B832E6FBDA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic", "libs\Anthropic\LangChain.Providers.Anthropic.csproj", "{4D242C9C-9B14-4B27-9EA2-91BF4525BB62}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LangChain.Providers.Anthropic.Generators", "libs\Anthropic.Generator\LangChain.Providers.Anthropic.Generators.csproj", "{0BD10678-5755-4226-B9A0-B448DED7217E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B06075D-EC7B-44F4-8C46-EFAF971FCDAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B06075D-EC7B-44F4-8C46-EFAF971FCDAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B06075D-EC7B-44F4-8C46-EFAF971FCDAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B06075D-EC7B-44F4-8C46-EFAF971FCDAC}.Release|Any CPU.Build.0 = Release|Any CPU
{4D242C9C-9B14-4B27-9EA2-91BF4525BB62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D242C9C-9B14-4B27-9EA2-91BF4525BB62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D242C9C-9B14-4B27-9EA2-91BF4525BB62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D242C9C-9B14-4B27-9EA2-91BF4525BB62}.Release|Any CPU.Build.0 = Release|Any CPU
{0BD10678-5755-4226-B9A0-B448DED7217E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BD10678-5755-4226-B9A0-B448DED7217E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BD10678-5755-4226-B9A0-B448DED7217E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BD10678-5755-4226-B9A0-B448DED7217E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4D242C9C-9B14-4B27-9EA2-91BF4525BB62} = {4FF98FFA-E401-4C16-8AA4-94B832E6FBDA}
{0BD10678-5755-4226-B9A0-B448DED7217E} = {4FF98FFA-E401-4C16-8AA4-94B832E6FBDA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {427C720F-B98F-44DA-ABF4-627A5D5F73AC}
EndGlobalSection
EndGlobal
20 changes: 20 additions & 0 deletions src/Providers/Anthropic/Delete-BIN-OBJ-Folders.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@ECHO off
cls

ECHO Deleting all BIN and OBJ folders...
ECHO.

FOR /d /r . %%d in (bin,obj,node_modules,Logs) DO (
IF EXIST "%%d" (
ECHO %%d | FIND /I "\node_modules\" > Nul && (
ECHO.Skipping: %%d
) || (
ECHO.Deleting: %%d
rd /s/q "%%d"
)
)
)

ECHO.
ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
pause > nul
Loading
Loading