Closed gunpal5 closed 2 months ago
This update primarily focuses on enhancing the Google Generative AI integration by upgrading the package version and refining various functionalities. Key changes include modifying the GoogleChatModel
constructor to accept additional parameters, simplifying JSON serialization in GoogleGeminiExtensions
, and updating predefined Gemini models to use new constructor parameters. Additionally, test cases have been improved to include assertions for token usage and pricing.
File Path | Change Summary |
---|---|
src/Directory.Packages.props |
Updated Google_GenerativeAI package version from 0.1.20 to 1.0.0 . |
src/Providers/Google/src/Extensions/... |
Simplified JsonSerializer.Serialize call in GetString extension method. |
src/Providers/Google/src/GoogleChatModel.cs |
Enhanced constructor with additional parameters for context length and token prices; added methods for usage and price calculation. |
src/Providers/Google/src/Predefined/... |
Updated parameters for GoogleChatModel constructors in various Gemini models. |
src/Providers/Google/test/Tests.cs |
Imported GeminiProModel and added assertions for InputTokens , OutputTokens , and PriceInUsd . |
🌟 In fields of code where changes bloom,
A rabbit hops, dispelling gloom.
With updates fresh, the models grow,
New versions set to steal the show.
Tokens counted, prices told,
In every line, the future bold.
🐇✨
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?
Authors of pull request: @gunpal5
Updated the version of the "Google_GenerativeAI" package from "0.1.20" to "1.0.0".
Sweep Found These Issues
Removed the custom serialization context for the arguments
dictionary in the GetString
method, defaulting to the standard JsonSerializer
settings.
Sweep Found These Issues
GetString
method may lead to inconsistent serialization behavior, particularly with property naming policies, null value handling, and enum handling.Added configurable parameters to the GoogleChatModel
constructor, introduced methods for calculating usage and price, and ensured consistent recording of usage metrics.
Sweep Found These Issues
CalculatePriceInUsd
method does not handle cases where inputTokenPriceUsd
or outputTokenPriceUsd
are zero, which could lead to incorrect pricing calculations.GetUsage
methods in OpenAiChatModel
and AnthropicModel
.CalculatePriceInUsd
methods in OpenAiChatModel
and AnthropicModel
.Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
CalculatePriceInUsd
method does not handle cases where inputTokenPriceUsd
, outputTokenPriceUsd
, secondaryInputTokenPrice
, or secondaryOutputTokenPrice
are zero or negative, which could lead to incorrect price calculations.Added new parameters to existing model constructors and introduced two new model classes with specific configurations.
Sweep Found These Issues
Gemini15ProModel
class incorrectly uses GoogleAIModels.Gemini15Flash
instead of GoogleAIModels.Gemini15Pro
.Gemini15FlashModel
is redundant as it performs similar tasks to existing functions like GeminiProModel
and GeminiProVisionModel
but with different parameters.Replaced GoogleChatModel
with GeminiProModel
in the GetWeather
test and added assertions for input tokens, output tokens, and price in USD.
Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.
GoogleAIModels.GeminiPro
in the instantiation of GeminiProModel
might affect its behavior if the constructor relies on that parameter.
I think need to replace Flash to Pro inside
Summary by CodeRabbit
New Features
Google_GenerativeAI
package, enhancing overall functionality and capabilities.GoogleChatModel
with new parameters for context length and token prices, providing more detailed usage and cost calculations.Improvements
GoogleGeminiExtensions
, improving performance and maintainability.Tests
GeminiProModel
and added assertions forInputTokens
,OutputTokens
, andPriceInUsd
for improved test coverage.