feat: Enable Filters in OpenAI Search API#4471
Merged
franciscojavierarceo merged 13 commits intoMar 10, 2026
Merged
Conversation
375e38f to
76520d2
Compare
552e0fb to
415cb9e
Compare
9e9b839 to
c93216a
Compare
7241907 to
8701d91
Compare
Contributor
✱ Stainless preview buildsThis PR will update the This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Contributor
|
This pull request has merge conflicts that must be resolved before it can be merged. @franciscojavierarceo please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
0a46cc9 to
8125175
Compare
9eee28c to
a36ef7e
Compare
e9e8e75 to
5d99e8b
Compare
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
ffc59e9 to
79b20b0
Compare
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
…ltering Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
cdoern
approved these changes
Mar 10, 2026
cdoern
left a comment
Collaborator
There was a problem hiding this comment.
lgtm, this is still in draft but looks pretty clean to me!
17 tasks
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
Apr 23, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
Apr 23, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
Apr 23, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
Apr 23, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
Apr 23, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
May 1, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
anik120
added a commit
to anik120/lightspeed-providers
that referenced
this pull request
May 1, 2026
Adds support for dynamic metadata filtering to the Solr vector IO provider, enabling users to filter RAG query results by metadata fields at runtime. NOTE: Dynamic filters from requests are **combined with** the existing static `chunk_filter_query` configuration (e.g., `"is_chunk:true"`) rather than replacing it. This preserves backward compatibility and maintains the internal schema filtering needed for chunk window expansion to work correctly. Both filters are joined with AND logic: fq=(is_chunk:true AND ) This approach avoids breaking changes while enabling flexible metadata filtering for use cases like filtering by platform, version, document type, etc. - Upstream PR: ogx-ai/ogx#4471
cdoern
added a commit
that referenced
this pull request
Jun 15, 2026
…sults (backport #6093) (#6117) ## Summary - The catch-all `except Exception` in `openai_search_vector_store` was silently swallowing backend errors and returning empty results with HTTP 200 - Clients had no way to distinguish "no matching documents" from "the search failed" - This masked bugs like the milvus-lite 3.0 `chunk_content` KeyError (#6089), where file_search appeared to work but retrieval silently returned nothing - Now re-raises the exception so it surfaces as a 500 to the client - Also fixes `test_openai_vector_store_with_chunks` which was passing `filters={"topic": "ai"}` (the old shorthand format) instead of the typed format `{"type": "eq", "key": "topic", "value": "ai"}` required since #4471. The error was silently swallowed, and the assertion loop over empty results never executed, so the test appeared to pass. Closes #6092 ## Test plan - Added unit test `test_search_vector_store_propagates_backend_errors` that verifies a `KeyError` from the backend propagates to the caller - Fixed `test_openai_vector_store_with_chunks` filter format so it actually exercises the filter path - Reproduced locally with milvus-lite 3.0: before the fix, search returns 200 with empty results; after, returns 500<hr>This is an automatic backport of pull request #6093 done by [Mergify](https://mergify.com). Signed-off-by: Derek Higgins <derekh@redhat.com> Co-authored-by: Derek Higgins <derekh@redhat.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Charlie Doern <cdoern@redhat.com>
mfleader
pushed a commit
to mfleader/llama-stack
that referenced
this pull request
Jun 15, 2026
…sults (ogx-ai#6093) ## Summary - The catch-all `except Exception` in `openai_search_vector_store` was silently swallowing backend errors and returning empty results with HTTP 200 - Clients had no way to distinguish "no matching documents" from "the search failed" - This masked bugs like the milvus-lite 3.0 `chunk_content` KeyError (ogx-ai#6089), where file_search appeared to work but retrieval silently returned nothing - Now re-raises the exception so it surfaces as a 500 to the client - Also fixes `test_openai_vector_store_with_chunks` which was passing `filters={"topic": "ai"}` (the old shorthand format) instead of the typed format `{"type": "eq", "key": "topic", "value": "ai"}` required since ogx-ai#4471. The error was silently swallowed, and the assertion loop over empty results never executed, so the test appeared to pass. Closes ogx-ai#6092 ## Test plan - Added unit test `test_search_vector_store_propagates_backend_errors` that verifies a `KeyError` from the backend propagates to the caller - Fixed `test_openai_vector_store_with_chunks` filter format so it actually exercises the filter path - Reproduced locally with milvus-lite 3.0: before the fix, search returns 200 with empty results; after, returns 500 --------- Signed-off-by: Derek Higgins <derekh@redhat.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Charlie Doern <cdoern@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Finishes #2435; i.e., adds support for OpenAI Search API typed filters for vector IO.
This PR adds support for OpenAI's typed metadata filter API across vector IO providers, enabling callers to filter search results by metadata fields using comparison operators (eq, ne, gt, gte, lt, lte, in, nin) and compound logic (and, or).
Core changes:
COMPARISON_OPS/SQL_OPSdict instead of if/elif chains.Test Plan
against faiss and sqlite-vec
the OpenAI vector store path
faiss
.venv/bin/python -m pytest tests/integration/vector_io/test_vector_io_filters.py
--stack-config="inference=inline::sentence-transformers,vector_io=inline::faiss,files=inline::localfs" -v
sqlite-vec
.venv/bin/python -m pytest tests/integration/vector_io/test_vector_io_filters.py
--stack-config="inference=inline::sentence-transformers,vector_io=inline::sqlite-vec,files=inline::localfs" -v
OpenAI vector store filter (mixin path)
.venv/bin/python -m pytest tests/integration/vector_io/test_openai_vector_stores.py::test_openai_vector_store_search_with_typed_filters
--stack-config="inference=inline::sentence-transformers,vector_io=inline::sqlite-vec,files=inline::localfs" -v