langchaingo
langchaingo copied to clipboard
vectorstore: Add initial implementation of inmemory vectorstore
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
orutil: 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.
this is ready for review.
rebase branch for resolve go.mod
, go.sum
conflict
Looks good to me :)
Is this math32 dependency necessary?
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)))
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.