-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: Added Deep Infra Provider #261
Conversation
WalkthroughThe recent updates to the LangChain solution involve significant enhancements to the DeepInfra provider, including new projects for code generation and integration tests, as well as the introduction of new classes for model management and configuration. Additionally, changes to the OpenAI provider reflect an update in the API version handling. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Apply Sweep Rules to your PR?
This is an automated message generated by Sweep AI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Out of diff range and nitpick comments (4)
src/Providers/DeepInfra/src/DeepInfraConfiguration.cs (1)
5-7
: Fill the summary tags to provide better documentation for theDeepInfraConfiguration
class.src/Providers/DeepInfra/src/DeepInfraProvider.cs (1)
6-15
: Ensure to add documentation for the constructors to explain the parameters and their usage, especially the custom endpoint and API version.src/Providers/DeepInfra/src/DeepInfraModel.cs (1)
6-23
: Ensure to add documentation for the constructors to explain the parameters and their usage, especially the model retrieval and default pricing values.src/Providers/DeepInfra/src/DeepInfraModelIds.cs (1)
26-26
: Complete the description for the modelMeta-Llama-3-8B-Instruct
.Consider adding a detailed description for this model to maintain consistency with other entries.
...s/DeepInfra/tools/LangChain.Providers.DeepInfra.CodeGenerator/Main/DeepInfraCodeGenerator.cs
Show resolved
Hide resolved
...s/DeepInfra/tools/LangChain.Providers.DeepInfra.CodeGenerator/Main/DeepInfraCodeGenerator.cs
Outdated
Show resolved
Hide resolved
...s/DeepInfra/tools/LangChain.Providers.DeepInfra.CodeGenerator/Main/DeepInfraCodeGenerator.cs
Show resolved
Hide resolved
using var handler = new HttpClientHandler(); | ||
//handler.CheckCertificateRevocationList = true; | ||
handler.AutomaticDecompression = | ||
DecompressionMethods.Deflate | DecompressionMethods.Brotli | DecompressionMethods.GZip; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider enabling certificate revocation check for enhanced security.
+ handler.CheckCertificateRevocationList = true;
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
using var handler = new HttpClientHandler(); | |
//handler.CheckCertificateRevocationList = true; | |
handler.AutomaticDecompression = | |
DecompressionMethods.Deflate | DecompressionMethods.Brotli | DecompressionMethods.GZip; | |
using var handler = new HttpClientHandler(); | |
handler.CheckCertificateRevocationList = true; | |
handler.AutomaticDecompression = | |
DecompressionMethods.Deflate | DecompressionMethods.Brotli | DecompressionMethods.GZip; |
[Test] | ||
public async Task GetWeather() | ||
{ | ||
var apiKey = | ||
Environment.GetEnvironmentVariable("Deep_Infra_Key") ?? | ||
throw new InvalidOperationException("Deep_Infra_Key environment variable is not found."); | ||
|
||
var model = new Mixtral8X7BInstructV01Model(new DeepInfraProvider(apiKey)); | ||
|
||
var service = new WeatherService(); | ||
model.AddGlobalTools(service.AsTools(), service.AsCalls()); | ||
|
||
var response = await model.GenerateAsync( | ||
new[] | ||
{ | ||
"You are a helpful weather assistant.".AsSystemMessage(), | ||
"What's the weather like today?".AsHumanMessage(), | ||
"Sure! Could you please provide me with your location?".AsAiMessage(), | ||
"Dubai, UAE".AsHumanMessage(), | ||
}); | ||
|
||
Console.WriteLine(response.Messages.AsHistory()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding assertions to validate the expected behavior of the GetWeather
test.
This test currently does not assert any conditions, which means it will not effectively validate the correctness of the GetWeather
functionality. Consider using assertions to check the contents of response.Messages
or other relevant properties to ensure the test is meaningful.
@@ -0,0 +1,8 @@ | |||
{ | |||
"profiles": { | |||
"LangChain.Providers.OpenRouter.CodeGenerator": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the project name in the launch settings to match the Deep Infra code generator.
…deGenerator/Main/DeepInfraCodeGenerator.cs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Added Deep Infra Provider with Source Generator
Summary by CodeRabbit