Skip to content

Instantly share code, notes, and snippets.

@pavlovmilen
Created July 14, 2024 10:27
Show Gist options
  • Save pavlovmilen/8a033887b65846a2ebaf578d2c6ebc17 to your computer and use it in GitHub Desktop.
Save pavlovmilen/8a033887b65846a2ebaf578d2c6ebc17 to your computer and use it in GitHub Desktop.
Filter on metadata
if metadata:
res = app.app_state.collection.query(
query_embeddings=query_embeddings,
n_results=results,
where={"Metadata": metadata},
include=["documents", "metadatas", "distances", "embeddings"]
)
else:
res = app.app_state.collection.query(
query_embeddings=query_embeddings,
n_results=results,
include=["documents", "metadatas", "distances", "embeddings"]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment