fix(web): reject BM25/RRF/vector-store query knobs on the cross-WASM RAG provider (#1057)

AD
4d ago
+836-53

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, and vectorStore are 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/queryStream throw invalidConfiguration naming any of the four knobs when set there.
  • Session-config, per-query, and retrieve-operator validation rejects non-finite bm25K1, bm25B outside [0,1], negative rrfK, k/similarity_threshold out of range, unknown vector_store values, and malformed params like "30junk" or "inf" instead of falling back to defaults; pgvector returns NOT_SUPPORTED.
  • RRF accumulates in double and breaks ties by id so a large rrfK cannot tie candidates; retrieve float params round-trip through the classic locale.
  • The VectorStore enum moved from solutions.proto to rag.proto; IDL version is bumped to 1.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.