Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement filters for MongoDBAtlasVectorSearch #1142

Merged
merged 10 commits into from
Sep 5, 2024

Conversation

thucpn
Copy link
Collaborator

@thucpn thucpn commented Aug 30, 2024

  • Able to populate metadata fields that need for filtering (Done)
  • Build mongodb filters based on operator (TODO)

@thucpn thucpn requested a review from marcusschiesser August 30, 2024 11:01
Copy link

vercel bot commented Aug 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
llama-index-ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 5, 2024 7:07am

Copy link

changeset-bot bot commented Aug 30, 2024

🦋 Changeset detected

Latest commit: d8c24ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
llamaindex Patch
docs Patch
@llamaindex/experimental Patch
@llamaindex/cloudflare-worker-agent-test Patch
@llamaindex/next-agent-test Patch
@llamaindex/nextjs-edge-runtime-test Patch
@llamaindex/next-node-runtime-test Patch
@llamaindex/waku-query-engine-test Patch
@llamaindex/autotool-02-next-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@thucpn thucpn changed the title feat: implement filters for MongoDB feat: implement filters for MongoDBAtlasVectorSearch Aug 30, 2024
similarity: "cosine",
};

// TODO: Build filters based on the operator
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: Build filters based on the operator

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, good idea to add this to the PR too

Copy link

pkg-pr-new bot commented Aug 30, 2024

Open in Stackblitz

@llamaindex/autotool

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/autotool@1142

@llamaindex/cloud

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/cloud@1142

@llamaindex/community

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/community@1142

@llamaindex/core

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/core@1142

@llamaindex/env

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/env@1142

@llamaindex/experimental

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/experimental@1142

@llamaindex/wasm-tools

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/@llamaindex/wasm-tools@1142

llamaindex

pnpm add https://pkg.pr.new/run-llama/LlamaIndexTS/llamaindex@1142

commit: d8c24ea

examples/mongodb/2_load_and_index.ts Outdated Show resolved Hide resolved
similarity: "cosine",
};

// TODO: Build filters based on the operator
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, good idea to add this to the PR too

@@ -60,8 +60,7 @@ function toMongoDBFilter(filters?: MetadataFilters): Record<string, any> {
return { $or: filters.filters.map(createFilterObject) };
}

console.debug("filters.condition not recognized. Returning empty object");
return {};
throw new Error("filters condition not recognized. Returning empty object");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Returning empty object doesn't make sense anymore, how about:

Suggested change
throw new Error("filters condition not recognized. Returning empty object");
throw new Error("filters condition not recognized. Must be AND or OR");

@marcusschiesser marcusschiesser merged commit 11b3856 into main Sep 5, 2024
19 checks passed
@marcusschiesser marcusschiesser deleted the feat/implement-filters-for-mongodb branch September 5, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants