fix(deps): update dependencies to use google/genai #1021
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant changes to the
tools/translator/translate.ts
file and a dependency update in thepackage.json
file. The primary focus is on updating the Google Generative AI library and refactoring the translation logic to accommodate this update.Dependency update:
package.json
: Updated the dependency from@google/generative-ai
to@google/genai
and changed the version to^0.8.0
.Refactoring translation logic:
tools/translator/translate.ts
: Replaced imports ofGoogleGenerativeAI
andGoogleAIFileManager
withGoogleGenAI
. Updated the class properties and constructor to use the newGoogleGenAI
client.tools/translator/translate.ts
: Removed the detailed model configuration and chat session setup from thetranslate
method. Instead, used theGoogleGenAI
client to generate content directly.tools/translator/translate.ts
: Simplified the translation prompt and adjusted the response handling to accommodate the new API. Added a fallback for cases where no response is received.tools/translator/translate.ts
: Removed redundant input format instructions from the translation prompt.