Closed gunpal5 closed 1 month ago
The recent updates primarily focus on refining functionality and improving accuracy in token counting, usage tracking, and model selection for Google and OpenAI providers. Key changes include updating the Google_GenerativeAI package version, enhancing token counting in GoogleChatModel, adjusting usage tracking in both GoogleChatModel and OpenAiChatModel, and updating the model used in Gemini15ProModel.
File Path | Change Summary |
---|---|
src/Directory.Packages.props |
Updated Google_GenerativeAI package version from 1.0.0 to 1.0.1 . |
src/.../GoogleChatModel.Tokens.cs |
Changed CountTokens method to take IEnumerable<Message> instead of string . |
src/.../GoogleChatModel.cs |
Adjusted ToMessage method to correctly update usage variable for accurate time tracking. |
src/.../Predefined/GeminiModels.cs |
Updated model in Gemini15ProModel class from Gemini15Flash to Gemini15Pro . |
src/.../OpenAiChatModel.cs |
Modified GetUsage method to use usage2 variable and updated subsequent method calls accordingly. |
sequenceDiagram
participant User
participant GoogleChatModel
participant GoogleAPI
participant OpenAiChatModel
User ->> GoogleChatModel: CountTokens(messages)
GoogleChatModel ->> GoogleAPI: Send messages for token count
GoogleAPI -->> GoogleChatModel: Return token count
GoogleChatModel -->> User: Return token count
User ->> GoogleChatModel: SendMessage
GoogleChatModel ->> GoogleAPI: Process message
GoogleAPI -->> GoogleChatModel: Return processed message
GoogleChatModel ->> GoogleChatModel: Update usage tracking
GoogleChatModel -->> User: Return processed message
User ->> OpenAiChatModel: SendMessage
OpenAiChatModel ->> OpenAIAPI: Process message
OpenAIAPI -->> OpenAiChatModel: Return processed message
OpenAiChatModel ->> OpenAiChatModel: Update usage2 tracking
OpenAiChatModel ->> OpenAiChatModel: Add usage2 to usage
OpenAiChatModel -->> User: Return processed message
In the world of code, where bytes do dance,
We've made some tweaks to enhance,
Tokens now count with greater ease,
Usage tracks with newfound peace.
Models updated, versions refined,
In this code, perfection you'll find.
🐇✨
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?
feat(GoogleGemini): Added CountTokens fix: fixed usages to correctly return the request usages.
Summary by CodeRabbit
New Features
Enhancements
Gemini15ProModel
to useGemini15Pro
for improved performance.GoogleChatModel
andOpenAiChatModel
for more accurate time and resource management.Dependencies
Google_GenerativeAI
package from version1.0.0
to1.0.1
for better stability and new features.