Filtering by metadata for File Search workaround

We make use of assistant, vector store and file search. We process and ingest contracts data for different companies and questions asked by end users are always within the context of the company and we want to filter retrieval phase to only include content for specific company. In the documentation for File Search I found that “Support for deterministic pre-search filtering using custom metadata.” is not supported. See https://platform.openai.com/docs/assistants/tools/file-search#how-it-works. Is there any workaround to achieve this kind of behaviour?

For strict, company-scoped retrieval, the most reliable approach is to control the retrieval layer yourself rather than relying entirely on the built-in File Search.

Ideally, you’d combine a relational (or document) database with a vector search engine and expose it through an API. The relational layer enforces hard filters like company_id, contract_type, or effective_date, while the vector layer handles semantic matching. Your assistant would call this API with predefined parameters and values, so the search is already scoped before the LLM sees anything. This gives you deterministic filtering, higher precision, and a much cleaner audit trail.

If you want a single, integrated system for this, Weaviate is a strong fit. You can:

Define a clear schema with strict metadata fields (e.g., company_id, doc_type, dates) and chunked text.

Use pre-filtering via where clauses so the vector search only runs within the correct subset of data.

Enable multi-tenancy for true isolation — each company’s data lives on separate shards, eliminating cross-company leakage.

Store multiple vectors per object or use multi-vector embeddings to capture different semantic views (title, body, clauses) and improve retrieval quality.

Combine hybrid search (BM25 + vector) with metadata filters to balance semantic recall with keyword precision.

The key is to clearly define how your data is stored: what metadata fields are queryable, what gets vectorized, how many vectors per object, and how chunks are shaped. With Weaviate, you can run deterministic, company-scoped searches in a single step — metadata filters first, then vector or hybrid ranking on the scoped set.

By pairing strict filtering with high-quality embeddings, you drastically cut noise, avoid irrelevant chunks, and give the LLM only what it needs. That keeps prompts smaller, improves grounding, and reduces hallucinations.

Most of the things you wrote is already handled by Open AI vector store where you can store additional attributes that allow you for precision filtering same as other market available tools have (Azure AI Search for ex.). The problem is that this is not supported within assistants API so all orchestration code and things like messages, threads etc must be custom code and this is something I would like to avoid. In short I can have deterministic prefiltering but this will require more custom orchestration code.

Ok, it was just a suggestion from a personal point of view which helped to avoid the extra issues down the workflows and scaling.