Skip to content

Add deep AI search to rerank all components in selected sources#2430

Open
Mbeaulne wants to merge 1 commit into
06-18-build_broader_ai_candidate_pools_for_component_searchfrom
06-18-improve_ai_rerank_payload_for_component_search
Open

Add deep AI search to rerank all components in selected sources#2430
Mbeaulne wants to merge 1 commit into
06-18-build_broader_ai_candidate_pools_for_component_searchfrom
06-18-improve_ai_rerank_payload_for_component_search

Conversation

@Mbeaulne

@Mbeaulne Mbeaulne commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds a Deep AI search button alongside the existing AI (smart) search button. While the standard AI search sends a limited, curated set of candidate components to the reranker, Deep AI search sends the entire searchable index — lexical hits first so truncating providers still see the most likely matches early — allowing the model to rerank across every available component in the selected sources.

Key changes:

  • Introduces buildDeepAiCandidateMatches, which builds a candidate pool from all indexed components (no cap), ordered with lexical matches first and remaining components appended alphabetically.
  • Exposes canDeepRerank and deepRerank from useComponentSearchV2State and wires them into both the Dashboard and Editor search UIs.
  • Enriches RerankCandidate with richer I/O metadata (type and description, not just names) and a source field, giving the model more signal when ranking.
  • Refactors the shared startAiSearch / startRerank helpers to accept an arbitrary candidate list, removing duplication between the standard and deep paths.
  • Updates componentReferenceToCandidate to accept an optional source argument and serialize I/O types (including complex object types) via JSON.stringify.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Open the component search panel (Dashboard or Editor).
  2. Enter a non-empty query.
  3. Confirm the Deep AI search button appears and is enabled when an AI provider is configured.
  4. Click Deep AI search and verify that results are reranked across all components in the selected sources, not just the top lexical candidates.
  5. Confirm the existing AI search (sparkles) button still behaves as before.
  6. Verify the button is disabled when the query is empty or no AI provider is configured.

Additional Comments

scoreAllCandidates is intentionally set to false for deep rerank to avoid scoring overhead across the full index on every result row. The standard AI search retains scoreAllCandidates: true so relevance percentages continue to appear on displayed results.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 06-18-improve_ai_rerank_payload_for_component_search/49294fe

Mbeaulne commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Mbeaulne Mbeaulne changed the title Improve AI rerank payload for component search Add deep AI search to rerank all components in selected sources Jun 18, 2026
@Mbeaulne Mbeaulne marked this pull request as ready for review June 18, 2026 17:59
@Mbeaulne Mbeaulne requested a review from a team as a code owner June 18, 2026 17:59
Comment thread src/routes/v2/pages/Editor/components/componentSearchV2Logic.ts Outdated
Comment thread src/routes/Dashboard/DashboardComponentsV2View.tsx Outdated
Comment thread src/routes/Dashboard/DashboardComponentsV2View.tsx
Comment thread src/routes/Dashboard/DashboardComponentsV2View.tsx Outdated
Comment thread src/routes/v2/pages/Editor/hooks/useComponentSearchV2State.ts
@Mbeaulne

Copy link
Copy Markdown
Collaborator Author

🤖 This is an AI-generated code review comment.

[MEDIUM] src/hooks/useNaturalLanguageComponentSearch.ts ~lines 38-50 — The rerank mutation passes no AbortSignal, so a now-much-heavier deep rerank cannot be cancelled if the user retypes. Pre-existing, but materially amplified by this feature. Follow-up: thread signal into the mutation so a new query aborts the in-flight deep call.

(Posted as a PR-level comment because this file has no changed lines in the diff to anchor an inline comment to.)

@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from 7d30372 to c443c7a Compare June 18, 2026 19:12
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from d363ca7 to 60b076d Compare June 18, 2026 19:12
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from c443c7a to 9fdd3d5 Compare June 18, 2026 20:28
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from 60b076d to 455266e Compare June 18, 2026 20:28
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from 9fdd3d5 to d9e254e Compare June 18, 2026 20:49
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch 2 times, most recently from 4a246ee to 8cc6222 Compare June 18, 2026 21:02
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from d9e254e to 1351eea Compare June 18, 2026 21:02
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from 8cc6222 to 88f3546 Compare June 18, 2026 21:16
Comment thread src/routes/v2/pages/Editor/components/ComponentSearchResults.tsx
Comment thread src/routes/Dashboard/DashboardComponentsV2View.tsx
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from dd4c88b to bda1e0b Compare June 24, 2026 18:11
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from 88f3546 to 9942e6c Compare June 24, 2026 18:11
@Mbeaulne Mbeaulne requested a review from camielvs June 24, 2026 18:19
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from bda1e0b to e790ecb Compare June 24, 2026 19:52
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from 9942e6c to 66fafa8 Compare June 24, 2026 19:52
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from e790ecb to ff9a02a Compare June 25, 2026 15:55
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from 13998df to bf05e0b Compare June 25, 2026 19:38
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from ff9a02a to 787da7b Compare June 25, 2026 19:38
@Mbeaulne Mbeaulne force-pushed the 06-18-build_broader_ai_candidate_pools_for_component_search branch from bf05e0b to 611c64f Compare June 25, 2026 19:43
@Mbeaulne Mbeaulne force-pushed the 06-18-improve_ai_rerank_payload_for_component_search branch from 787da7b to 49294fe Compare June 25, 2026 19:43
Comment thread src/routes/v2/pages/Editor/hooks/useComponentSearchV2State.ts
Comment thread src/routes/Dashboard/DashboardComponentsV2View.tsx
Comment thread src/routes/v2/pages/Editor/components/ComponentSearchV2Content.tsx
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