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

add GroqSharp provider #303

Merged
merged 1 commit into from
May 15, 2024
Merged

add GroqSharp provider #303

merged 1 commit into from
May 15, 2024

Conversation

danijerez
Copy link
Contributor

@danijerez danijerez commented May 15, 2024

I have added the groq provider using https://github.com/Sarel-Esterhuizen/GroqSharp
the code needs some adjustment.

Summary by CodeRabbit

  • New Features

    • Introduced new projects for various providers including GroqSharp, Reka, and OpenAI.
    • Added support for GroqSharp with new configuration settings and models.
  • Bug Fixes

    • Adjusted project types for integration tests to ensure compatibility.
  • Chores

    • Added and reorganized workflow files for better project management.
    • Updated package versions, including GroqSharp to version 1.1.2.
  • Tests

    • Added comprehensive tests for GroqSharp provider functionalities.

Copy link
Contributor

sweep-ai bot commented May 15, 2024

Sweep: PR Review

Sweep is currently reviewing your pr...

@CLAassistant
Copy link

CLAassistant commented May 15, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

coderabbitai bot commented May 15, 2024

Walkthrough

The update introduces significant enhancements to the LangChain project. Key changes include adding new projects and tests for providers like GroqSharp and Reka, integrating a new workflow file, and reorganizing existing workflows. New classes and methods have been implemented to support GroqSharp functionalities, and package configurations have been updated accordingly. The adjustments also include project type changes and the addition of new package versions.

Changes

Files/Paths Change Summary
LangChain.sln Added new workflow file, reorganized workflows, added new projects, and adjusted project types.
src/Directory.Packages.props Added a new package version entry for "GroqSharp" version "1.1.2".
src/Providers/GroqSharp/... Implemented GroqSharpChatModel, GroqSharpConfiguration, GroqSharpProvider, and predefined models.
src/Providers/GroqSharp/test/... Introduced tests for GroqSharp, including configurations and async method tests.
src/Providers/GroqSharp/src/... Updated project configuration settings for .NET 8.0 and added package references.

🐇
In code we trust, with lines so neat,
New projects bloom, a coder's feat.
GroqSharp joins the LangChain dance,
With tests and workflows in advance.
Let's celebrate this grand array,
Of changes made in a coding way!
🌟


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 41da8fb and 5bd1465.
Files selected for processing (9)
  • LangChain.sln (5 hunks)
  • src/Directory.Packages.props (1 hunks)
  • src/Providers/GroqSharp/src/GroqSharpChatModel.cs (1 hunks)
  • src/Providers/GroqSharp/src/GroqSharpConfiguration.cs (1 hunks)
  • src/Providers/GroqSharp/src/GroqSharpProvider.cs (1 hunks)
  • src/Providers/GroqSharp/src/LangChain.Providers.GroqSharp.csproj (1 hunks)
  • src/Providers/GroqSharp/src/Predefined/GroqSharpModels.cs (1 hunks)
  • src/Providers/GroqSharp/test/GroqSharpTests.cs (1 hunks)
  • src/Providers/GroqSharp/test/LangChain.Providers.GroqSharp.Test.csproj (1 hunks)
Files skipped from review due to trivial changes (4)
  • src/Directory.Packages.props
  • src/Providers/GroqSharp/src/GroqSharpConfiguration.cs
  • src/Providers/GroqSharp/src/LangChain.Providers.GroqSharp.csproj
  • src/Providers/GroqSharp/test/LangChain.Providers.GroqSharp.Test.csproj
Additional comments not posted (18)
src/Providers/GroqSharp/src/GroqSharpProvider.cs (3)

6-10: Constructor looks good.


12-24: Constructor looks good.


5-5: Property definition looks good.

src/Providers/GroqSharp/src/GroqSharpChatModel.cs (5)

13-39: Verify the usage of ChatSettings.Default.

Ensure that ChatSettings.Default is appropriate for the context.


41-44: Method looks good.


46-49: Method looks good.


50-58: Method looks good.


12-12: Property definition looks good.

LangChain.sln (10)

40-40: Addition of deep-infra.yml looks good.


347-348: Addition of LangChain.Providers.Reka project looks good.


349-349: Addition of LangChain.Providers.Reka.Tests project looks good.


351-351: Addition of LangChain.Serve.OpenAI project looks good.


353-353: Addition of LangChain.Samples.Serve.OpenAI project looks good.


355-355: Addition of LangChain.Samples.LocalRAG project looks good.


357-358: Addition of LangChain.Providers.GroqSharp project looks good.


361-361: Addition of LangChain.Providers.GroqSharp.Test project looks good.


341-341: Change of project type for LangChain.DocumentLoaders.IntegrationTests looks good.


347-348: Change of project type for LangChain.Providers.Reka looks good.

Comment on lines +4 to +5
public class Llama38b8192(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "llama3-8b-8192");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name should follow PascalCase naming convention.

- public class Llama38b8192(GroqSharpProvider provider)
+ public class Llama38B8192(GroqSharpProvider provider)

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.

Suggested change
public class Llama38b8192(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "llama3-8b-8192");
public class Llama38B8192(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "llama3-8b-8192");

Comment on lines +7 to +8
public class Llama370b8192(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "llama3-70b-8192");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name should follow PascalCase naming convention.

- public class Llama370b8192(GroqSharpProvider provider)
+ public class Llama370B8192(GroqSharpProvider provider)

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.

Suggested change
public class Llama370b8192(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "llama3-70b-8192");
public class Llama370B8192(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "llama3-70b-8192");

Comment on lines +10 to +11
public class Mixtral8x7b32768(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "mixtral-8x7b-32768");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name should follow PascalCase naming convention.

- public class Mixtral8x7b32768(GroqSharpProvider provider)
+ public class Mixtral8X7B32768(GroqSharpProvider provider)

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.

Suggested change
public class Mixtral8x7b32768(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "mixtral-8x7b-32768");
public class Mixtral8X7B32768(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "mixtral-8x7b-32768");

Comment on lines +13 to +14
public class Gemma7bIt(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "gemma-7b-it");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name should follow PascalCase naming convention.

- public class Gemma7bIt(GroqSharpProvider provider)
+ public class Gemma7BIt(GroqSharpProvider provider)

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.

Suggested change
public class Gemma7bIt(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "gemma-7b-it");
public class Gemma7BIt(GroqSharpProvider provider)
: GroqSharpChatModel(provider, id: "gemma-7b-it");

Comment on lines +10 to +26
[Test]
public async Task Chat()
{

var config = new GroqSharpConfiguration()
{
ApiKey = Environment.GetEnvironmentVariable("GROQ_API_KEY") ??
throw new InconclusiveException("GROQ_API_KEY is not set."),
ModelId = "llama3-70b-8192"
};

var provider = new GroqSharpProvider(config);
var model = new Llama370b8192(provider);

string answer = await model.GenerateAsync("Generate some random name:");

Console.WriteLine(answer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add assertions to verify the generated response.

- Console.WriteLine(answer);
+ Assert.IsNotNull(answer);
+ Assert.IsNotEmpty(answer);
+ Console.WriteLine(answer);

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.

Suggested change
[Test]
public async Task Chat()
{
var config = new GroqSharpConfiguration()
{
ApiKey = Environment.GetEnvironmentVariable("GROQ_API_KEY") ??
throw new InconclusiveException("GROQ_API_KEY is not set."),
ModelId = "llama3-70b-8192"
};
var provider = new GroqSharpProvider(config);
var model = new Llama370b8192(provider);
string answer = await model.GenerateAsync("Generate some random name:");
Console.WriteLine(answer);
[Test]
public async Task Chat()
{
var config = new GroqSharpConfiguration()
{
ApiKey = Environment.GetEnvironmentVariable("GROQ_API_KEY") ??
throw new InconclusiveException("GROQ_API_KEY is not set."),
ModelId = "llama3-70b-8192"
};
var provider = new GroqSharpProvider(config);
var model = new Llama370b8192(provider);
string answer = await model.GenerateAsync("Generate some random name:");
Assert.IsNotNull(answer);
Assert.IsNotEmpty(answer);
Console.WriteLine(answer);

@HavenDV HavenDV merged commit 3520804 into tryAGI:main May 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants