langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

vectorstore: Add initial implementation of inmemory vectorstore

Open HatsuneMiku3939 opened this issue 4 months ago • 6 comments

Hello everyone,

I believe that having a memory vector store would be helpful our development and testing processes.

PR Checklist

  • [x] Read the Contributing documentation.
  • [x] Read the Code of conduct documentation.
  • [x] Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
  • [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • [x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. Fixes #123).
  • [x] Describes the source of new concepts.
  • [x] References existing implementations as appropriate.
  • [x] Contains test coverage for new functions.
  • [x] Passes all golangci-lint checks.

HatsuneMiku3939 avatar Feb 18 '24 09:02 HatsuneMiku3939

this is ready for review.

HatsuneMiku3939 avatar Feb 20 '24 10:02 HatsuneMiku3939

rebase branch for resolve go.mod, go.sum conflict

HatsuneMiku3939 avatar Feb 22 '24 12:02 HatsuneMiku3939

Looks good to me :)

corani avatar Feb 27 '24 07:02 corani

Is this math32 dependency necessary?

tmc avatar Mar 13 '24 22:03 tmc

Is this math32 dependency necessary?

Not strictly required, but it avoids a bunch of type conversions as Go does most floating point math in float64 rather than float32.

This will work as well, but is less clear:

sim := dot / float32(math.Sqrt(float64(s1))*math.Sqrt(float64(s2)))

corani avatar Mar 14 '24 02:03 corani

As we've let the number of dependencies grow, it's going to start creating maintenance burden and we may separate the core from the implementations. Until then I'd like to try to limit the new dependencies added.

tmc avatar Mar 18 '24 23:03 tmc