-
-
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 Amazon Bedrock Mistral Large model #198
Conversation
remove legacy Bedrock anthropic.claude-v1 model
…sKey. updated provider docs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…tic method to EnumerableExtensions
…tings for all Bedrock models
Apply Sweep Rules to your PR?
This is an automated message generated by Sweep AI. |
WalkthroughThe recent updates across chat and embedding models in the project aim to enhance functionality and customization. These changes introduce new methods for generating responses, refine settings for tailored interactions, and optimize input handling for improved model performance and adaptability. Changes
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 (
|
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: 3
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (19)
- src/Directory.Packages.props (1 hunks)
- src/Providers/Abstractions/src/Embedding/IEmbeddingModel.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Ai21LabsJurassic2ChatModel.cs (4 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/AmazonTitanChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaude3ChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaudeChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/CohereCommandChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/MetaLlama2ChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/MistralInstructChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/Ai21LabsJurassic2ChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/AmazonTitanChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/AnthropicChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/AnthropicClaude3ChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/CohereCommandChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/MetaLlama2ChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/Settings/MistralInstructChatSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanEmbeddingModel.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanImageEmbeddingModel.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Predefined/Mistral.cs (1 hunks)
Files not reviewed due to errors (4)
- (no review received)
- (no review received)
- (no review received)
- (no review received)
Additional comments not posted (18)
src/Providers/Abstractions/src/Embedding/IEmbeddingModel.cs (1)
6-11
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-13]
Removal of
MaximumInputLength
aligns with PR objectives. Ensure all implementations ofIEmbeddingModel
are updated accordingly.src/Providers/Amazon.Bedrock/src/Predefined/Mistral.cs (1)
12-14
: Addition ofMistralLarge
class is consistent with the framework's model structure.src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanEmbeddingModel.cs (1)
10-15
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-37]
Ensure the removal of
MaximumInputLength
does not impact the handling of large inputs inCreateEmbeddingsAsync
.src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanImageEmbeddingModel.cs (1)
10-15
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-37]
Ensure the removal of
MaximumInputLength
does not impact the handling of large inputs or large numbers of images inCreateEmbeddingsAsync
.src/Providers/Amazon.Bedrock/src/Chat/Ai21LabsJurassic2ChatModel.cs (1)
58-80
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [13-79]
Enhancements to
GenerateAsync
and addition ofCreateBodyJson
improve flexibility and maintainability.src/Providers/Amazon.Bedrock/src/Chat/Settings/AnthropicChatSettings.cs (1)
1-80
: Introduction ofAnthropicChatSettings
aligns with the framework's approach to model-specific chat settings.src/Providers/Amazon.Bedrock/src/Chat/Settings/MetaLlama2ChatSettings.cs (1)
1-80
: Introduction ofMetaLlama2ChatSettings
maintains consistency in handling model-specific chat settings.src/Providers/Amazon.Bedrock/src/Chat/Settings/AmazonTitanChatSettings.cs (1)
1-80
: Introduction ofAmazonTitanChatSettings
complements the framework's standardized approach to chat settings.src/Providers/Amazon.Bedrock/src/Chat/Settings/CohereCommandChatSettings.cs (2)
4-15
: Ensure the default settings align with the intended use cases forCohereCommandChatSettings
.
25-78
: Consider validating the input parameters of theCalculate
method to ensure they are not all null, which could lead to unexpected behavior.src/Providers/Amazon.Bedrock/src/Chat/Settings/MistralInstructChatSettings.cs (2)
4-15
: Ensure the default settings forMistralInstructChatSettings
are appropriate for the Mistral model's requirements.
25-78
: Consider adding input validation to theCalculate
method to prevent potential issues when all input settings are null.src/Providers/Amazon.Bedrock/src/Chat/Settings/AnthropicClaude3ChatSettings.cs (2)
4-15
: Verify that the default settings forAnthropicClaude3ChatSettings
meet the specific needs of the Anthropic Claude 3 model.
25-78
: Recommend adding parameter validation in theCalculate
method to handle cases where all input settings might be null.src/Providers/Amazon.Bedrock/src/Chat/Settings/Ai21LabsJurassic2ChatSettings.cs (2)
4-15
: Confirm that the default settings forAi21LabsJurassic2ChatSettings
are correctly configured for the Ai21 Labs Jurassic 2 model.
25-78
: Suggest implementing input validation in theCalculate
method to ensure robustness when all input settings are null.src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaude3ChatModel.cs (1)
22-22
: Changes toGenerateAsync
method align well with the class's focus on Anthropic models.src/Directory.Packages.props (1)
33-33
: Addition of "Microsoft.AspNetCore.StaticFiles" package is noted. Ensure compatibility with other project dependencies.
BinaryData? image = null) | ||
{ | ||
settings = settings ?? throw new ArgumentNullException(nameof(settings)); | ||
usedSettings = usedSettings ?? throw new ArgumentNullException(nameof(usedSettings)); |
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 using modern C# syntax for null checking.
- usedSettings = usedSettings ?? throw new ArgumentNullException(nameof(usedSettings));
+ _ = usedSettings ?? throw new ArgumentNullException(nameof(usedSettings));
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.
usedSettings = usedSettings ?? throw new ArgumentNullException(nameof(usedSettings)); | |
_ = usedSettings ?? throw new ArgumentNullException(nameof(usedSettings)); |
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: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (7)
- src/Providers/Amazon.Bedrock/src/Chat/Ai21LabsJurassic2ChatModel.cs (4 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/AmazonTitanChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaude3ChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaudeChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/CohereCommandChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/MetaLlama2ChatModel.cs (3 hunks)
- src/Providers/Amazon.Bedrock/src/Chat/MistralInstructChatModel.cs (3 hunks)
Files skipped from review as they are similar to previous changes (7)
- src/Providers/Amazon.Bedrock/src/Chat/Ai21LabsJurassic2ChatModel.cs
- src/Providers/Amazon.Bedrock/src/Chat/AmazonTitanChatModel.cs
- src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaude3ChatModel.cs
- src/Providers/Amazon.Bedrock/src/Chat/AnthropicClaudeChatModel.cs
- src/Providers/Amazon.Bedrock/src/Chat/CohereCommandChatModel.cs
- src/Providers/Amazon.Bedrock/src/Chat/MetaLlama2ChatModel.cs
- src/Providers/Amazon.Bedrock/src/Chat/MistralInstructChatModel.cs
…here models. fix: Amazon Cohere embeddings
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: 1
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (7)
- src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanEmbeddingModel.cs (2 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanImageEmbeddingModel.cs (2 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/CohereEmbeddingModel.cs (4 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/Settings/AmazonEmbeddingSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/Settings/AmazonMultiModalEmbeddingSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/src/Embedding/Settings/CohereEmbeddingSettings.cs (1 hunks)
- src/Providers/Amazon.Bedrock/test/BedrockTests.cs (2 hunks)
Additional comments not posted (12)
src/Providers/Amazon.Bedrock/src/Embedding/Settings/CohereEmbeddingSettings.cs (2)
4-10
: Consider documenting the default settings for clarity.
20-43
: Ensure proper handling of null values inCalculate
method to avoid potentialInvalidOperationException
.src/Providers/Amazon.Bedrock/src/Embedding/Settings/AmazonEmbeddingSettings.cs (2)
4-10
: Consider documenting the default settings for clarity.
20-43
: Ensure proper handling of null values inCalculate
method to avoid potentialInvalidOperationException
.src/Providers/Amazon.Bedrock/src/Embedding/Settings/AmazonMultiModalEmbeddingSettings.cs (1)
4-10
: Consider documenting the default settings for clarity.src/Providers/Amazon.Bedrock/src/Embedding/CohereEmbeddingModel.cs (2)
14-20
: Ensure the method documentation is updated to reflect the new parameters and their purposes.
43-53
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [30-64]
Validate the handling of
MaximumInputLength
andDimensions
inusedSettings
to ensure they are correctly applied.Verification successful
The handling of
MaximumInputLength
andDimensions
inusedSettings
is consistently and correctly applied across the application, as evidenced by their usage in different embedding models for splitting text and initializing float arrays, respectively. This aligns with the expected behavior for these settings in the context of embedding models.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the handling of MaximumInputLength and Dimensions in usedSettings is consistent and correct across the application. rg "usedSettings.MaximumInputLength" rg "usedSettings.Dimensions"Length of output: 841
src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanEmbeddingModel.cs (2)
14-20
: Ensure the method documentation is updated to reflect the new parameters and their purposes.
31-31
: Validate the handling ofMaximumInputLength
andDimensions
inusedSettings
to ensure they are correctly applied.Verification successful
The handling of
MaximumInputLength
andDimensions
inusedSettings
is verified to be consistent and correctly applied across the application. The usage in different embedding models aligns with the expected functionality of these settings.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the handling of MaximumInputLength and Dimensions in usedSettings is consistent and correct across the application. rg "usedSettings.MaximumInputLength" rg "usedSettings.Dimensions"Length of output: 841
src/Providers/Amazon.Bedrock/src/Embedding/AmazonTitanImageEmbeddingModel.cs (2)
14-19
: Ensure the method documentation is updated to reflect the new parameters and their purposes.
29-29
: Validate the handling ofMaximumInputLength
andDimensions
inusedSettings
to ensure they are correctly applied.Verification successful
The provided shell script output indicates that both
MaximumInputLength
andDimensions
properties ofusedSettings
are being utilized in the application, specifically within the context of splitting text based onMaximumInputLength
and creating float arrays based onDimensions
. This usage occurs across different embedding models (AmazonTitanImageEmbeddingModel
,CohereEmbeddingModel
, andAmazonTitanEmbeddingModel
), suggesting a consistent application of these settings.Given this context, it appears that the handling of
MaximumInputLength
andDimensions
inusedSettings
is indeed consistent and correctly applied across the application, as evidenced by their use in splitting text and allocating arrays for embeddings, respectively. This consistency in application supports the correctness of their implementation in relation to the original review comment's concern.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the handling of MaximumInputLength and Dimensions in usedSettings is consistent and correct across the application. rg "usedSettings.MaximumInputLength" rg "usedSettings.Dimensions"Length of output: 841
src/Providers/Amazon.Bedrock/test/BedrockTests.cs (1)
295-307
: Ensure theTestEmbedding
method correctly uses theprompt
variable and validates the embedding results.
also added default ChatSettings for all Bedrock models
Summary by CodeRabbit
MaximumInputLength
property from embedding models to align with updated input length constraints.