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: metadata filtering #12

Merged
merged 3 commits into from
Jun 7, 2023
Merged

Conversation

grossvogel
Copy link
Contributor

@grossvogel grossvogel commented Jun 6, 2023

Connects to #6

  • Allow the options for query/3 to take a :filter key, validate that it's a map, and pass it through to the API call to execute a filtered query
  • Add delete_by_filter/3 a :filter opt to delete_all_vectors/2 to delete all vectors matching the provided filter

Again, I'm happy to adjust how this is done to fit your vision for the library. Thanks!

lib/pinecone.ex Outdated
@@ -306,6 +306,34 @@ defmodule Pinecone do
delete({:vectors, "#{name}-#{project_name}"}, "vectors/delete", opts[:config], params: params)
end

@doc """
Deletes all vectors from the given Pinecone index that match the given metadata filter.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason to not have this method be a variant of delete with a :filter keyword?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe not a great reason: the docs say the ids, deleteAll, and filter params are mutually exclusive, so I wanted to avoid making an interface that appears to accept combinations of inputs that are in fact inconsistent or invalid. I guess it wouldn't make it too confusing to have it be a part of delete_all_vectors/2 though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made that change

@seanmor5
Copy link
Collaborator

seanmor5 commented Jun 6, 2023

@grossvogel Thanks for the contributions. I don't plan to maintain this library long term as I no longer have a use for it. If you want to take up the sword I can transfer the repository to you!

@grossvogel
Copy link
Contributor Author

@seanmor5 Thanks you for the library, and all the other cool stuff you've been doing in the ecosystem! I'll get back to you on the long-term maintenance question... we're still experimenting with Pinecone at this stage

@seanmor5 seanmor5 merged commit 6bb1a8d into MikaAK:main Jun 7, 2023
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