feat(js/plugins/compat-oai): add translation adapter and add translation flow in testapps#4786
Conversation
Summary of ChangesHello @7hokerz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces the capability to perform audio translation using OpenAI models within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces support for OpenAI's audio translation models, specifically mapping whisper-1-translate to whisper-1 for translation workflows. The changes include adding new types, model information, and configuration schemas for translation, along with corresponding functions to handle translation requests and responses. The openai/index.ts file is updated to integrate these new translation functionalities, and a new openai/translation.ts file defines the OpenAI-specific translation model references. A test application file is also updated to include a translation sample. Overall, the changes are well-structured and follow existing patterns within the codebase.
|
Thank you @7hokerz for adding this. I agree with the changes in the compat-oai plugin, but I'm unsure about the On one hand, this is an "pseudo" model, which makes it confusing for the user to discover. Also, there are no more One way to approach this to either:
|
|
@ssbushi, I totally see your point, and I've actually been having the same concerns myself. It’s a tricky trade-off, and I agree it needs a better solution. |
Yeah, I think the config based fix makes sense here, but for that to work we may need to do a bit of a refactor. Here's the plan:
This refactor means we will have to separate out the WDYT? |
|
@ssbushi, I'll give it a try based on your opinion. |
|
@ssbushi, could you please take a look at this when you have a moment? |
|
Thank you @7hokerz, added a quick comment. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for OpenAI's audio translation feature by introducing a new defineCompatOpenAIWhisperModel and related components. The changes correctly separate whisper models from transcription-only models. The implementation is largely solid, but I've identified a few areas for improvement. Specifically, there's a typo in a constant name, significant code duplication that could be refactored for better maintainability, and a type-safety issue with requestBuilder that could lead to errors. I've provided detailed comments with suggestions for each of these points.
|
I've finished the refactoring as discussed and added the test codes for Whisper. @ssbushi, could you please take a look at this when you have a moment? |
There was a problem hiding this comment.
Code Review
This pull request introduces support for OpenAI's audio translation models by dynamically mapping requests utilizing whisper-1-translate to whisper-1 before hitting the OpenAI API. It includes new files for translation functionality and updates existing files to incorporate the new translation flow. The changes also include corresponding test cases to ensure the new feature works as expected.
Description here... Help the reviewer by:
(Specially, requests utilizing
whisper-1-translateare dynamically mapped towhisper-1before hitting the OpenAI API to distinguish between STT and translation workflows)(I'm not sure if this is the best approach. I'm open to suggestions if you see any issues)
Checklist (if applicable):