langchain icon indicating copy to clipboard operation
langchain copied to clipboard

parameterized distance metrics; lint; format; tests

Open EandrewJones opened this issue 1 year ago • 1 comments

Parameterize Redis vectorstore index

Redis vectorstore allows for three different distance metrics: L2 (flat L2), COSINE, and IP (inner product). Currently, the Redis._create_index method hard codes the distance metric to COSINE.

I've parameterized this as an argument in the Redis.from_texts method -- pretty simple.

Fixes #4368

Before submitting

I've added an integration test showing indexes can be instantiated with all three values in the REDIS_DISTANCE_METRICS literal. An example notebook seemed overkill here. Normal API documentation would be more appropriate, but no standards are in place for that yet.

Who can review?

Not sure who's responsible for the vectorstore module... Maybe @eyurtsev / @hwchase17 / @agola11 ?

EandrewJones avatar May 09 '23 02:05 EandrewJones

@hwchase17 this looks reasonable to me. I haven't worked as much with the vector stores, so maybe another set of :eye: will be helpful. Also left a challenge for @EandrewJones if he's up for it. :)

eyurtsev avatar May 09 '23 02:05 eyurtsev