refactor: remove dead embedding/classify code from regular PreparationStage - #668
Conversation
…parationStage Signed-off-by: Chang Su <chang.s.su@oracle.com>
Summary of ChangesHello, 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 refactors the Highlights
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
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe changes remove embedding preparation stage integration from the main preparation router. The EmbeddingPreparationStage's Default implementation is deleted, and the embedding_stage field is removed from PreparationStage struct, along with updates to request type handling logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This is a good refactoring that improves code consistency by removing the unnecessary new() and Default implementations from the EmbeddingPreparationStage unit struct. The changes are correct and well-contained.
I've added a suggestion to apply a similar simplification to PreparationStage itself.
For further consistency, you might consider applying the same refactoring to other unit structs in a follow-up PR, such as:
EmbeddingRequestBuildingStageEmbeddingResponseProcessingStageClassifyResponseProcessingStage
Overall, a solid cleanup.
…tage The regular PreparationStage delegated to EmbeddingPreparationStage for Embedding and Classify request types, but these requests are routed to dedicated pipelines (new_embeddings/new_classify) and never reach the regular pipeline. Remove the dead code and error on unexpected request types instead. Also restore new() on EmbeddingPreparationStage for consistency with other stages constructed in pipeline.rs. Signed-off-by: Chang Su <chang.s.su@oracle.com>
Description
Problem
EmbeddingPreparationStagewas wired into the regularPreparationStagedelegator for Embedding and Classify request types. However, these requests are routed to their own dedicated pipelines (new_embeddings/new_classify) by the gRPC router and never reach the regular pipeline — making this delegation dead code.Additionally,
EmbeddingPreparationStagehad an inconsistent construction style compared to other stages: it used::new()in some places and bare struct syntax in others.Solution
EmbeddingPreparationStagefrom the delegatingPreparationStageand replace the Embedding/Classify match arms with an error (matching the existing Responses arm pattern)new()onEmbeddingPreparationStagefor consistency with other stages constructed inpipeline.rsDefaultimpl that was only needed to satisfy clippy for the now-removednew()Changes
preparation.rs(delegator): Removeembedding_stagefield and Embedding/Classify match arms; collapse into a single error arm for unexpected request typesembedding/preparation.rs: Restorenew()constructor, removeDefaultimplpipeline.rs: UseEmbeddingPreparationStage::new()consistentlyTest Plan
Checklist
cargo +nightly fmtpassescargo clippy --all-targets --all-features -- -D warningspassesSummary by CodeRabbit