Skip to content

Conversation

@Jacopo47
Copy link

Issue

Closes #393

Change

General checklist

  • There are no breaking changes
  • I have added unit and integration tests for my change
  • I have manually run all the unit tests in all modules, and they are all green
  • I have manually run all integration tests in the module I have added/changed, and they are all green

Checklist for adding new maven module

  • I have added my new module in the root pom.xml and langchain4j-community-bom/pom.xml

Checklist for adding new embedding store integration

  • I have added a {NameOfIntegration}EmbeddingStoreIT that extends from either EmbeddingStoreIT or EmbeddingStoreWithFilteringIT
  • I have added a {NameOfIntegration}EmbeddingStoreRemovalIT that extends from EmbeddingStoreWithRemovalIT

Checklist for changing existing embedding store integration

  • I have manually verified that the {NameOfIntegration}EmbeddingStore works correctly with the data persisted using the latest released version of LangChain4j

@Martin7-1
Copy link
Collaborator

@Jacopo47 Thanks for the great work! I'm wondering if we should use UnifiedJedis as the client like RedisEmbeddingStore?

Copy link
Collaborator

@Martin7-1 Martin7-1 left a comment

Choose a reason for hiding this comment

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

@Jacopo47 Thank you!

Could you please add Builder pattern and some javadoc in the constructor and class to clarify the meaing of parameters in the constructor.

BTW, to make spotless happy, please run make format. Thank you!


import java.util.UUID;

class RedisVectorSetsEmbeddingStoreRemovalIT extends EmbeddingStoreWithRemovalIT {
Copy link
Collaborator

Choose a reason for hiding this comment

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

copy-paste issue in filename, should be RedisVectorSetsEmbeddingStoreRemovalIT.java

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class RedisVectorSetsEmbeddingStoreIT implements AutoCloseable {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please extend it with EmbeddingStoreIT or EmbeddingStoreWithFilteringIT

if (input == null) return null;

Function<Collection<?>, String> collectIntoArray = i -> {
List<String> values = i
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: could be simplified with:

var joined = i
                    .stream()
                    .map(e -> {
                        if (e == null) {
                            return null;
                        } else if (e instanceof String s) {
                            return toString(s);
                        } else if (e instanceof  UUID s){
                            return toString(s);
                        } else {
                            return e.toString();
                        }
                    })
                    .filter(Objects::nonNull)
                    .collect(Collectors.joining(","));

.flatMap(filterMapper::from);

if (filter.isPresent()) {
filter.ifPresent(params::filter);
Copy link
Collaborator

Choose a reason for hiding this comment

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

duplicate filter.isPresent() check here.

.stream()
.map(mapToEmbeddingMatch)
.filter(Optional::isPresent)
.map(Optional::orElseThrow)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think throwing an exception when there are no matching elements seems a bit too harsh. Wouldn't it be better to just return an empty list?

@Martin7-1 Martin7-1 added enhancement New feature or request P2 High priority P3 Medium priority theme: embedding store Issues/PRs related to embedding store labels Dec 6, 2025
@Jacopo47
Copy link
Author

Jacopo47 commented Dec 9, 2025

Hi, @Martin7-1
thank you for your review!
I'll work on it asap

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

Labels

enhancement New feature or request P2 High priority P3 Medium priority theme: embedding store Issues/PRs related to embedding store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Integrate with redis vector sets as EmbeddingStore

2 participants