-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
style:Run dotnet format #164
Conversation
WalkthroughThe changes update multiple files in the repository. In the Google-related extensions, attributes have been added to indicate requirements for unreferenced and dynamic code, along with adjustments to using directive order. Several files have received minor formatting updates and spacing corrections. Additionally, asynchronous behavior in the chat model was refined by adding a ConfigureAwait(false) call. The embedding model functionality was enhanced through the addition of a new constructor and property, a new class for text embeddings was introduced, and corresponding updates were made in the helper functions. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant H as Helpers (GetModels)
participant P as GoogleProvider
participant G as GoogleTextEmbedding
C->>H: Request model for ProviderType.Google
H->>P: Retrieve GoogleProvider instance
H->>G: Create new GoogleTextEmbedding(provider)
G-->>H: Return embedding instance
H-->>C: Return model
Possibly related PRs
Suggested reviewers
Poem
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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: 1
🧹 Nitpick comments (1)
src/IntegrationTests/Helpers.cs (1)
123-124
: Add a comment explaining the embedding model choice.For consistency with other provider implementations, add a comment explaining whether this is a native Google embedding model or a temporary solution.
+ // Using Google's native text embedding model var embeddings = new GoogleTextEmbedding(provider);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
src/Google/src/Extensions/GoogleGeminiExtensions.cs
(2 hunks)src/Google/src/Extensions/StringExtensions.cs
(1 hunks)src/Google/src/GoogleChatModel.cs
(3 hunks)src/Google/src/GoogleEmbeddingModel.cs
(1 hunks)src/Google/src/GoogleEmbeddingSettings.cs
(2 hunks)src/Google/src/GoogleProvider.cs
(1 hunks)src/Google/src/Predefined/GoogleEmbeddingModels.cs
(0 hunks)src/IntegrationTests/BaseTests.cs
(1 hunks)src/IntegrationTests/Helpers.cs
(1 hunks)
💤 Files with no reviewable changes (1)
- src/Google/src/Predefined/GoogleEmbeddingModels.cs
✅ Files skipped from review due to trivial changes (3)
- src/IntegrationTests/BaseTests.cs
- src/Google/src/GoogleEmbeddingSettings.cs
- src/Google/src/Extensions/StringExtensions.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and test / Build, test and publish
🔇 Additional comments (5)
src/Google/src/GoogleEmbeddingModel.cs (2)
9-12
: LGTM! Primary constructor syntax improves readability.The use of primary constructor syntax for dependency injection is clean and concise.
37-38
: Good use of ConfigureAwait(false).The addition of ConfigureAwait(false) is appropriate for library code to prevent potential deadlocks and improve performance.
src/Google/src/GoogleProvider.cs (1)
35-35
: Consider initializing EmbeddingSettings in constructors.The new property is not initialized in any of the constructors. While null is a valid state for this property, consider whether it should have a default value.
src/Google/src/Extensions/GoogleGeminiExtensions.cs (1)
56-58
: LGTM! Good addition of trimming and AOT compatibility attributes.The attributes correctly warn about potential issues with JSON serialization during trimming and AOT compilation.
src/Google/src/GoogleChatModel.cs (1)
115-115
: Good use of ConfigureAwait(false).The addition of ConfigureAwait(false) to StreamContentAsync is appropriate for library code to prevent potential deadlocks and improve performance.
@@ -120,7 +120,7 @@ public static (IChatModel ChatModel, IEmbeddingModel EmbeddingModel, IProvider P | |||
throw new InconclusiveException("GOOGLE_API_KEY is not set"), | |||
httpClient: new HttpClient()); |
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.
🛠️ Refactor suggestion
Consider using HttpClientFactory for better resource management.
The inline creation of HttpClient instances can lead to socket exhaustion. Consider using IHttpClientFactory for better lifecycle management.
- httpClient: new HttpClient());
+ httpClient: httpClientFactory.CreateClient("Google"));
Add IHttpClientFactory as a dependency:
public static class Helpers
{
private static readonly IHttpClientFactory _httpClientFactory;
static Helpers(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
}
// ... rest of the code
}
Created by Github Actions
Summary by CodeRabbit
New Features
Refactor / Maintenance