Semantic Search — Filing Body
search_filing_embedsPure vector search over per-chunk full-document embeddings (filing_embeds, ~12.4M rows across ~65K filings — each filing sliced into ~190 paragraph-sized chunks). The most granular semantic surface in the corpus.
Cost: one query-embedding call + one indexed Postgres lookup. No LLM planning, no LLM composition.
Right surface for:
"Find the exact passage discussing X" — granular text-search where you need the paragraph not just the filing.
"Find filings whose body text mentions X" when the summary-level surface (
search_summary_embeds) might miss a topic buried in a long PDF."Drill into this specific filing semantically" — pass
serffto restrict the cosine search to a single filing. Without scoping, commodity-vocabulary chunks from other filings can out-rank your target filing; scoping eliminates that.
Wrong surface for:
Filing-level questions where multiple hits per filing are noise — use
search_summary_embeds(one match per filing).Concrete-filter questions like "Filings from carrier NAIC 12345 in 2024" — use
search_filings.
aggregate: true (default) collapses to top-K filings by best-chunk similarity (one row per filing, the best matching paragraph as excerpt). aggregate: false returns top-K raw chunks (may include several from the same filing) — use when the user asked to see the actual paragraphs. When serff is set, aggregate is forced to false (every hit is the same filing already).
Returns top-K hits, each with {serff, chunk_index, similarity, excerpt, meta}. Default topK=10, max 50. Excerpt is the first 800 chars of the matching chunk.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| naic | No | Exact NAIC carrier identifier (5-digit string). | |
| topK | No | Number of top hits to return. Defaults to 10; capped at 50. If filters narrow the candidate set below topK you get what's there, no silent fallback to cross-filing matches. | |
| year | No | Exact filing year. Mutually exclusive with year_from/year_to. | |
| query | Yes | Natural-language query. Pass the user's question verbatim when you can — short, specific queries (5-30 words) match best. The query is embedded and cosine-compared against per-chunk body embeddings. | |
| serff | No | Optional SERFF id to scope the chunk search to a single filing (shape PREFIX-IDENTIFIER, e.g. "REGU-134742228"). Use this when you already know which filing you want to read semantically — e.g. "find the territory factor table in REGU-134742228". | |
| state | No | Two-letter US state code, uppercase. Corpus currently covers CA only. | |
| date_to | No | Upper bound on filing date (ISO YYYY-MM-DD). | |
| year_to | No | Upper bound on filing year, inclusive. | |
| aggregate | No | When true (default), collapse to top-K filings by best-chunk similarity. When false, return top-K raw chunks (may include multiple chunks from the same filing). Ignored (forced to false) when `serff` is set — scoping to one filing always returns raw chunks. | |
| date_from | No | Lower bound on filing date (ISO YYYY-MM-DD). | |
| year_from | No | Lower bound on filing year, inclusive. | |
| filing_type | No | Wildcard match on filing type ("Rate", "Rule", "Form", etc.). Substring match. | |
| product_type | No | Wildcard match on product type. Substring match — "Auto" matches Personal Auto and Commercial Auto. | |
| predecessor_prefix | No | Bureau / org SERFF prefix ("ISOF", "NCCI", "AAIS", "MSO"). |