Skip to content

[Core] Add enum for EngineType#2555

Merged
hickeyma merged 3 commits intoLMCache:devfrom
hickeyma:add-engine-enum
Feb 20, 2026
Merged

[Core] Add enum for EngineType#2555
hickeyma merged 3 commits intoLMCache:devfrom
hickeyma:add-engine-enum

Conversation

@hickeyma
Copy link
Copy Markdown
Collaborator

@hickeyma hickeyma commented Feb 6, 2026

What this PR does / why we need it:

When reviewing #2530 I noticed TODO comment in https://github.com/LMCache/LMCache/pull/2530/changes#diff-326d8fc676c10c1741ac777eded66dbf331e12da7dc41c9074b7a25a8e224f78R20-R23.

This PR added enum for engine types to replace strings.

Special notes for your reviewers:

If applicable:

  • this PR contains user facing changes - docs added
  • this PR contains unit tests

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @hickeyma, 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 LMCache codebase by introducing a dedicated EngineType enum. This change replaces the use of magic strings for identifying different GPU connector engines with a more robust and type-safe enumeration. The primary impact is improved code readability, maintainability, and reduced potential for errors due to typos or inconsistent string usage across the application.

Highlights

  • Introduced EngineType Enum: A new EngineType enum has been added to lmcache/v1/gpu_connector/__init__.py to represent different GPU connector engine types (VLLM, SGLANG, MOCK), replacing the use of magic strings.
  • Replaced String Literals with Enum: All instances where string literals like 'sglang', 'vllm', and 'mock' were used to identify engine types have been replaced with their corresponding EngineType enum members across various files.
  • Improved Type Safety: The CreateGPUConnector function signature has been updated to accept EngineType instead of a generic string, enhancing type safety, code clarity, and reducing potential for errors.

🧠 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
  • lmcache/integration/sglang/sglang_adapter.py
    • Imported EngineType from lmcache.v1.gpu_connector.
    • Updated the CreateGPUConnector call to use EngineType.SGLANG instead of the string 'sglang'.
  • lmcache/v1/gpu_connector/init.py
    • Added from enum import Enum import.
    • Defined the EngineType enum with members VLLM, SGLANG, and MOCK.
    • Modified the CreateGPUConnector function signature to accept engine: EngineType.
    • Updated the internal logic of CreateGPUConnector to compare against EngineType.SGLANG, EngineType.VLLM, and EngineType.MOCK instead of string literals.
    • Updated the docstring for CreateGPUConnector to reflect the new EngineType parameter.
  • lmcache/v1/manager.py
    • Imported EngineType from lmcache.v1.gpu_connector.
    • Updated the CreateGPUConnector call to use EngineType.VLLM instead of the string 'vllm'.
  • lmcache/v1/standalone/main.py
    • Imported EngineType from lmcache.v1.gpu_connector.
    • Updated the CreateGPUConnector call to use EngineType.MOCK instead of the string 'mock'.
Activity
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an EngineType enum to replace the use of string literals for identifying engine types, which is a great improvement for code clarity and type safety. The changes are applied consistently across the codebase. I have one suggestion to refactor the CreateGPUConnector function to use a factory pattern, which would further enhance maintainability and make it easier to add new engine types in the future.

@hickeyma hickeyma requested a review from sammshen February 6, 2026 12:15
@sammshen sammshen mentioned this pull request Feb 9, 2026
12 tasks
@sammshen
Copy link
Copy Markdown
Contributor

@hickeyma #2567 has merged and there are more places to replace "vllm" and "sglang"

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
@hickeyma hickeyma enabled auto-merge (squash) February 18, 2026 11:51
@hickeyma
Copy link
Copy Markdown
Collaborator Author

@hickeyma #2567 has merged and there are more places to replace "vllm" and "sglang"

Thanks @sammshen for the heads up. Updated the new code changes and ready for review.

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Copy link
Copy Markdown
Collaborator

@DongDongJu DongDongJu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DongDongJu DongDongJu added the full Run comprehensive tests on this PR label Feb 18, 2026
Copy link
Copy Markdown
Contributor

@sammshen sammshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hickeyma hickeyma merged commit e0a7be6 into LMCache:dev Feb 20, 2026
40 of 42 checks passed
DongDongJu pushed a commit to DongDongJu/LMCache that referenced this pull request Feb 22, 2026
* Add enum for EngineType

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Add EngineType enum to updatyed code

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

---------

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: DongDongJu <commisori28@gmail.com>
DongDongJu pushed a commit to DongDongJu/LMCache that referenced this pull request Feb 22, 2026
* Add enum for EngineType

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Add EngineType enum to updatyed code

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

---------

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
@hickeyma hickeyma deleted the add-engine-enum branch February 23, 2026 12:04
sammshen pushed a commit to sammshen/LMCache that referenced this pull request Mar 1, 2026
* Add enum for EngineType

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Add EngineType enum to updatyed code

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

---------

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
hlin99 pushed a commit to hlin99/LMCache that referenced this pull request Mar 2, 2026
* Add enum for EngineType

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Add EngineType enum to updatyed code

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

---------

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
mauryaavinash95 pushed a commit to mauryaavinash95/LMCache that referenced this pull request Mar 7, 2026
* Add enum for EngineType

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Add EngineType enum to updatyed code

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

---------

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
shaoxiawjc pushed a commit to shaoxiawjc/LMCache that referenced this pull request Mar 11, 2026
* Add enum for EngineType

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Add EngineType enum to updatyed code

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

---------

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: shaoxiawjc <wjc2800@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full Run comprehensive tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants