Skip to content

refactor: Simplifies VectorStoreChatMemoryAdvisor code #3773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

digitpic
Copy link

@digitpic digitpic commented Jul 9, 2025

  • The update refactors the VectorStoreChatMemoryAdvisor class by simplifying import statements, streamlining code for readability, and using more concise Java constructs. There are no changes to public APIs or core logic. All modifications focus on internal clarity, direct imports, and more idiomatic Java syntax.

  • Readability: The code is refactored to improve readability by using local variables to hold intermediate results.

  • Maintainability: The refactoring aims to enhance maintainability through clearer type declarations and a more structured approach.

  • Code Style: The changes include using more explicit type declarations instead of var.

image
  • All tests passed.

Refactors VectorStoreChatMemoryAdvisor for improved readability and maintainability.

Uses local variables to hold intermediate results, and ensures type declarations for clarity.

Signed-off-by: Kyuwon Jeong <[email protected]>
@ilayaperumalg
Copy link
Member

@digitpic Thanks for the PR cleaning up/polishing the code.

@ilayaperumalg ilayaperumalg self-assigned this Jul 10, 2025
@Amine-Kadi
Copy link

* Code Style: The changes include using more explicit type declarations instead of var.

Is there a style guide that forbid the usage of var ? The usage of var with the builder seems pretty fine and easy to read.

@digitpic
Copy link
Author

@Amine-Kadi
Thank you for replying.

I agree that using var in builder patterns can improve readability.
However, I decided to make the change because I believe that explicit type declarations are more beneficial for long-term code maintainability.

While using var does not clearly violate any style guide, explicitly declaring the type helps convey the intent of the code more clearly. Additionally, var can sometimes infer unintended types, which could lead to debugging overhead.

For these reasons, I consider explicit type declarations to be a safer and more consistent choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants