langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

vectorstores: add `Replacement` option

Open creeper12356 opened this issue 1 year ago • 3 comments

vectorstores: add Replacement option

This PR introduce a Replacement member to the vectorstores options. This option can be used in AddDocuments function. When Replacement is set to true, AddDocuments function will delete old record with the same Metadata attribute. (i.e to replace). When Replacement is set to false (default case) , AddDocuments function will simply add documents without checking existing document records.

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.

creeper12356 avatar Nov 07 '24 03:11 creeper12356

@creeper12356 can you refresh this and as mentioned above have some non-implementation case for other stores would be nice.

tmc avatar Feb 13 '25 04:02 tmc

@tmc I will try to refresh this in one month. Thanks for noticing. :smile:

creeper12356 avatar Feb 15 '25 13:02 creeper12356

I've added non-implementation case for other stores, but I'm confused why the CI/Lint check fails now. Errors:

Error: Failed to run: Error: Command failed: /home/runner/golangci-lint-1.61.0-linux-amd64/golangci-lint config verify
jsonschema: "run" does not validate with "/properties/run/additionalProperties": additionalProperties 'exclude-dirs' not allowed
jsonschema: "linters-settings.depguard" does not validate with "/properties/linters-settings/properties/depguard/additionalProperties": additionalProperties 'list-type', 'packages', 'additional-guards' not allowed
Failed executing command with error: the configuration contains invalid elements
, Error: Command failed: /home/runner/golangci-lint-1.61.0-linux-amd64/golangci-lint config verify
jsonschema: "run" does not validate with "/properties/run/additionalProperties": additionalProperties 'exclude-dirs' not allowed
jsonschema: "linters-settings.depguard" does not validate with "/properties/linters-settings/properties/depguard/additionalProperties": additionalProperties 'list-type', 'packages', 'additional-guards' not allowed
Failed executing command with error: the configuration contains invalid elements

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:[30](https://github.com/tmc/langchaingo/actions/runs/13469188999/job/37640463506?pr=1062#step:4:33)5:5)
Error: Command failed: /home/runner/golangci-lint-1.61.0-linux-amd64/golangci-lint config verify
jsonschema: "run" does not validate with "/properties/run/additionalProperties": additionalProperties 'exclude-dirs' not allowed
jsonschema: "linters-settings.depguard" does not validate with "/properties/linters-settings/properties/depguard/additionalProperties": additionalProperties 'list-type', 'packages', 'additional-guards' not allowed
Failed executing command with error: the configuration contains invalid elements

The Copilot tells me to remove some attributes in .golangci.yaml, but I've never changed this kind of file before. Does anyone would like to help ? :face_holding_back_tears:

creeper12356 avatar Feb 22 '25 03:02 creeper12356