fix(web): reject BM25/RRF/vector-store query knobs on the cross-WASM RAG provider (#1057)
AD
4d ago+836+836+012345678901234567890123456789-53-53-01234567890123456789
The cross-WASM provider ranks by embedding similarity in TypeScript, so bm25K1, bm25B, rrfK and vectorStore silently did nothing there. query and queryStream now throw invalidConfiguration naming the knobs when any is set on that provider, and RagRetrievalOptions documents them as native-session-only. Test covers both verbs with the native ABI unavailable.
Stacked on #1048, so the diff includes its commits until it merges.
Closes #1057
Summary by cubic
Adds BM25, RRF, and vector-store tuning knobs to RAG queries on the native on-device stack, and makes the cross-WASM web provider reject them loudly instead of silently ignoring them.
bm25K1,bm25B,rrfK, andvectorStoreare now honored per query by the native backend; all four bindings (Swift, Kotlin, Python, Web) expose and thread them into the retrieval options proto.- The cross-WASM provider ranks by embedding similarity only, so
query/queryStreamthrowinvalidConfigurationnaming any of the four knobs when set there. - Session-config, per-query, and retrieve-operator validation rejects non-finite
bm25K1,bm25Boutside[0,1], negativerrfK,k/similarity_thresholdout of range, unknownvector_storevalues, and malformed params like"30junk"or"inf"instead of falling back to defaults;pgvectorreturnsNOT_SUPPORTED. - RRF accumulates in double and breaks ties by id so a large
rrfKcannot tie candidates; retrieve float params round-trip through the classic locale. - The
VectorStoreenum moved fromsolutions.prototorag.proto; IDL version is bumped to1.7.0.
Summary by CodeRabbit
-
New Features
- RAG queries can customize BM25 scoring and reciprocal-rank fusion, or select the USEARCH vector store.
- These retrieval options are available in the Kotlin, Python, Swift, and web APIs. Unspecified values continue to use session defaults.
-
Bug Fixes
- Invalid or unsupported retrieval settings are rejected with validation errors.
- The cross-WASM RAG fallback rejects options it does not support. PGVector remains unsupported for on-device retrieval.