Issue with JSONPath with a in array check
Describe the bug I am trying to use a filter clause as follows
metadata_query = {"where": { "jsonpath": "[$[*] ? (@.source in ['a', 'b'])]"}} retriever = vs.as_retriever( search_kwargs={"metadata": metadata_query})
To Reproduce just create a ZepVectorStore and try the above
Expected behavior able to define a retriever which will only fetch documents which have source as either a or b
Logs Am getting this error
zep_python.exceptions.APIError: API error: {'status_code': 500, 'message': 'failed to search collection: failed to execute search: error executing search: error executing query: error scanning query ERROR: syntax error at or near "[" of jsonpath input (SQLSTATE=42601)\n'}
The JSONPath expression is fine as far as I can see. So is that I can only filter simple ==, != etc based checks?
Thanks for reporting. While we investigate, would you like to use Zep filter boolean logic here rather than an in operation? I recognize this may not be helpful if the array is large.
https://docs.getzep.com/sdk/search_query/#combining-multiple-jsonpath-filters-using-boolean-logic
Thanks @danielchalef for your quick feedback. Am trying to test out Zep for a use case that I have, so will wait for your response while I continue. Needless to say wanted to be able to check against a variable which has a List of filenames that user provides to run a query against.
Any luck with this @danielchalef ?
Hey @raghavendracs unfortunately I've not had time to investigate. We use Postgres' JSONPath flavor. If the in syntax is not supported by Postgres, it won't work with Zep:
https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-SQLJSON-PATH