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

add metadata filters to help with our results #17

Open
jackabald opened this issue Aug 8, 2024 · 0 comments
Open

add metadata filters to help with our results #17

jackabald opened this issue Aug 8, 2024 · 0 comments

Comments

@jackabald
Copy link
Owner

jackabald commented Aug 8, 2024

from llama_index.core.vector_stores.types import (
   MetadataFilter,
   MetadataFilters,
)

query_engine = index.as_query_engine(
   filters=MetadataFilters(
      filters=[
         MetadataFilter(key="book", value="paul_graham", operator="!="),
      ]
   ),
   similarity_top_k=2,
)
response = query_engine.query("What did the author learn?")
print(textwrap.fill(str(response), 100))

This is an example from these docs: https://docs.pingcap.com/tidbcloud/vector-search-integrate-with-llamaindex on how when we query for data like how response does in code_search.py we can use metadata filters. Research these filters and find if they could be helpful.

@jackabald jackabald changed the title find out of metadata filters is something that can help our model results add metadata filters to help with our results Aug 8, 2024
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

No branches or pull requests

1 participant