Skip to content

RI-8317 Detect and highlight large vector embeddings in the query editor#6215

Merged
dantovska merged 7 commits into
mainfrom
fe/feature/RI-8317/detect-large-vector-embeddings
Jul 22, 2026
Merged

RI-8317 Detect and highlight large vector embeddings in the query editor#6215
dantovska merged 7 commits into
mainfrom
fe/feature/RI-8317/detect-large-vector-embeddings

Conversation

@dantovska

@dantovska dantovska commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What

Adds detection for large vector embeddings in the query editor, plus a subtle highlight so they're visible.

  • Pure detector (utils/monaco/vectorEmbeddingUtils.ts): detectVectorEmbeddings(query) scans query text and returns a mark per embedding. Two formats:
    • binary FLOAT32 \x blobs, validated with the existing isBinaryVector heuristic;
    • numeric arrays with ≥ 10 elements.
      Each mark carries range, format, byte size, dimensions, a first-3/last-2 preview, and the FT.SEARCH PARAMS argument name when applicable (located via splitQueryByArgs). Thresholds are named constants; marks/types live in their own file.
  • useVectorEmbeddingMarks hook exposes the marks, recomputed on query change.
  • VectorEmbeddingHighlight — a self-contained component (own styles + detection + Monaco decorations) rendered next to the editor in both Workbench and Vector Search. It paints a subtle grey background behind each embedding, with an i18n hover showing dimensions and byte size. The shared CodeEditor / useQueryEditor are left untouched so the embedding logic can grow independently.

Testing

Unit testsutils/tests/monaco/vectorEmbeddingUtils.spec.ts cover both formats, multiple embeddings in one query, threshold edges, non-vector strings, and PARAMS name extraction:

node node_modules/.bin/jest 'redisinsight/ui/src/utils/tests/monaco/vectorEmbeddingUtils.spec.ts' -c jest.config.cjs

Manual — open a database → Workbench or Vector Search editor and paste the query below:

FT.SEARCH idx:bikes_vss "*=>[KNN 3 @description_embeddings $my_blob AS score ]" RETURN 4 score brand type description PARAMS 2 my_blob "\x98=\xd0\xbb\x94\xeb\xdb<C\x85\xf3:@\xdf$=\xd8\xf5\xbf\xbc\xa2\xdb\x04=3\x10\x22<\x8f\xc0)\xbd" SORTBY score DIALECT 2

The my_blob embedding value should render with a subtle grey background (slightly greyed out on both light and dark themes), and hovering it should show the dimensions and byte size.


Closes #RI-8317


Note

Low Risk
Editor-only UI and parsing for display; no changes to query execution, auth, or data persistence.

Overview
Adds detection and in-editor highlighting for large vector embeddings in Workbench and Vector Search query editors, so long \x blobs and numeric arrays are easier to spot in FT/KNN queries.

A new detectVectorEmbeddings scanner finds quoted binary FLOAT32 strings (via existing isBinaryVector) and numeric arrays with at least 10 elements, and can attach FT.SEARCH PARAMS argument names when the embedding is passed as a param value. VectorEmbeddingHighlight sits beside the shared CodeEditor, uses Monaco inline decorations (.monaco-vector-embedding), and shows an i18n hover with dimensions and byte size.

The feature is kept out of the core CodeEditor / useQueryEditor path; editors only pass monacoObjects and query from context. Unit tests cover detection edge cases and PARAMS name mapping.

Reviewed by Cursor Bugbot for commit d57ca21. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Code Coverage - Frontend unit tests

St.
Category Percentage Covered / Total
🟢 Statements 83.48% 28023/33569
🟡 Branches 69.53% 11963/17205
🟡 Functions 78.43% 7441/9488
🟢 Lines 83.92% 27269/32494

Test suite run success

7852 tests passing in 867 suites.

Report generated by 🧪jest coverage report action from d57ca21

@dantovska
dantovska force-pushed the fe/feature/RI-8317/detect-large-vector-embeddings branch from d25aecb to 5a9bf1b Compare July 20, 2026 10:33
@dantovska dantovska self-assigned this Jul 20, 2026
@dantovska
dantovska force-pushed the fe/feature/RI-8317/detect-large-vector-embeddings branch from 5a9bf1b to 5a97a26 Compare July 20, 2026 10:51
@dantovska dantovska removed the AI-Made label Jul 20, 2026
@dantovska
dantovska force-pushed the fe/feature/RI-8317/detect-large-vector-embeddings branch from 5a97a26 to 5952bbb Compare July 20, 2026 11:00
@dantovska
dantovska marked this pull request as ready for review July 20, 2026 12:09
@dantovska
dantovska requested a review from a team as a code owner July 20, 2026 12:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 221b066167

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread redisinsight/ui/src/utils/monaco/vectorEmbeddingUtils.ts
--monaco-color-bg: ${bgColor};
--monaco-color-params: ${colors.text.discovery200};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😀

Add a pure, source-agnostic detector that scans query text and returns
marks (range + metadata) for every large vector embedding it finds:
binary FLOAT32 "\x" blobs (validated with isBinaryVector) and numeric
arrays with >= 10 elements. Each mark carries range, format, byte size,
dimensions, a first-3/last-2 preview, and the FT.SEARCH PARAMS argument
name when applicable.

Expose the marks through a useVectorEmbeddingMarks hook composed inside
useQueryEditor, so both the Workbench and Vector Search editors receive
them with no extra wiring. Recomputes on query change. Data only, no
user-visible change yet; the collapse-rendering ticket consumes these
marks.

References: #RI-8317
Render a subtle inline background (plus a hover tooltip showing format,
dimensions and byte size) behind every embedding surfaced by
useVectorEmbeddingMarks. The new useVectorEmbeddingDecorations hook maps
each mark's character range to a Monaco range and applies decorations,
mirroring the existing useQueryDecorations pattern. Composed inside
useQueryEditor, so both the Workbench and Vector Search editors show the
highlight. Adds a themed .monaco-vector-embedding style.

References: #RI-8317
Move the embedding highlight out of the shared CodeEditor into a
self-contained VectorEmbeddingHighlight component (styles + detection +
decoration logic) so it can grow independently. CodeEditor and
useQueryEditor are no longer touched by embedding concerns; the component
is rendered next to the editor in Workbench and Vector Search.

Also move the VectorEmbeddingMark/VectorEmbeddingFormat types into a
dedicated vectorEmbeddingUtils.types.ts and trim non-essential comments.

References: #RI-8317
- i18n the embedding hover tooltip (en/bg) instead of a hardcoded
  English string, and stop exposing the raw format enum to users
- extract a buildMark helper to remove duplication between the two
  detection branches
- keep style import last and trim the highlight barrel to a single export

References: #RI-8317
Drop the border; keep just a neutral greyish background with a small
radius behind detected embeddings.

References: #RI-8317
PARAMS <nargs> counts the tokens that follow (each name and value), not
name/value pairs, so the PARAMS lookup must iterate nargs / 2 pairs.
Using nargs directly walked past the params list on multi-param queries
and could stamp a bogus paramName on an embedding outside PARAMS. Add
regression tests for multi-param and trailing non-param blobs.

References: #RI-8317
@dantovska
dantovska force-pushed the fe/feature/RI-8317/detect-large-vector-embeddings branch from 415ca0c to d57ca21 Compare July 22, 2026 13:18
@dantovska
dantovska merged commit 9b1cbca into main Jul 22, 2026
21 checks passed
@dantovska
dantovska deleted the fe/feature/RI-8317/detect-large-vector-embeddings branch July 22, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants