Skip to content

refactor(semantic-search): use ai sdk embedder contract#70

Merged
aryasaatvik merged 1 commit into
devfrom
feat/semantic-search-make-embedder
Jun 27, 2026
Merged

refactor(semantic-search): use ai sdk embedder contract#70
aryasaatvik merged 1 commit into
devfrom
feat/semantic-search-make-embedder

Conversation

@aryasaatvik

@aryasaatvik aryasaatvik commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

Simplifies the semantic-search vector embedding API to a single AI SDK-backed makeEmbedder contract. Hosts now create provider models and pass an explicit embedder into the vector backend.

Changes

  • Replace Gemini, Cloudflare Workers AI, and raw OpenAI-compatible plugin constructors with generic makeEmbedder.
  • Remove provider-specific vector backend options such as workersAi, geminiApiKey, and embedder model config.
  • Keep provider construction only in the local eval harness and add focused tests for batching, provider options, and dimension validation.

Tests

  • ./node_modules/.bin/oxfmt --check packages/plugins/semantic-search/src/sdk/embedder.ts packages/plugins/semantic-search/src/sdk/embedder.test.ts packages/plugins/semantic-search/src/sdk/embedding-service.ts packages/plugins/semantic-search/src/sdk/eval.ts packages/plugins/semantic-search/src/sdk/index.ts packages/plugins/semantic-search/src/sdk/tool-search-backend.ts packages/plugins/semantic-search/package.json packages/plugins/semantic-search/tsup.config.ts
  • ./node_modules/.bin/oxlint -c .oxlintrc.jsonc packages/plugins/semantic-search/src/sdk/embedder.ts packages/plugins/semantic-search/src/sdk/embedder.test.ts packages/plugins/semantic-search/src/sdk/embedding-service.ts packages/plugins/semantic-search/src/sdk/eval.ts packages/plugins/semantic-search/src/sdk/index.ts packages/plugins/semantic-search/src/sdk/tool-search-backend.ts --deny-warnings
  • bun run --filter @executor-js/plugin-semantic-search test -- src/sdk/embedder.test.ts src/sdk/plugin.test.ts src/sdk/search.test.ts
  • bun run --filter @executor-js/plugin-semantic-search typecheck
  • bun run --filter @executor-js/plugin-semantic-search test

Stack

  1. fix(semantic-search): process AI Search indexing in batches #69
  2. refactor(semantic-search): use ai sdk embedder contract #70 👈 current

@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR refactors semantic-search embedding to use a generic AI SDK embedder contract. The main changes are:

  • Adds makeEmbedder around AI SDK embedding models.
  • Removes provider-specific Gemini, Cloudflare, and OpenAI-compatible constructors from the runtime API.
  • Moves provider setup into the eval harness.
  • Updates vector backend options to require an explicit embedder.
  • Adds tests for batching, provider options, and dimension validation.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/plugins/semantic-search/src/sdk/embedder.ts Replaces the Gemini-specific embedder with a generic AI SDK model wrapper.
packages/plugins/semantic-search/src/sdk/tool-search-backend.ts Removes provider-specific backend configuration and uses only an explicit embedder.
packages/plugins/semantic-search/src/sdk/embedding-service.ts Replaces provider-specific layers with a generic embedder layer.
packages/plugins/semantic-search/src/sdk/eval.ts Builds Gemini and OpenAI-compatible provider models inside the eval harness.
packages/plugins/semantic-search/src/sdk/index.ts Updates public exports for the new generic embedder surface.
packages/plugins/semantic-search/package.json Moves provider SDK packages into development dependencies for the eval harness.

Reviews (2): Last reviewed commit: "refactor(semantic-search): use ai sdk em..." | Re-trigger Greptile

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​ai-sdk/​openai-compatible@​1.0.419010010098100

View full report

@aryasaatvik aryasaatvik changed the base branch from feat/semantic-search-ai-search-queue to dev June 27, 2026 14:00
aryasaatvik added a commit that referenced this pull request Jun 27, 2026
## Summary
- add batch-oriented AI Search reindexing so hosts can submit bounded
catalog pages
- make AI Search item names fingerprinted and reconcile remote/local
item state safely
- update the semantic-search operator UI copy/status/error handling for
Cloudflare AI Search

## Validation
- bun run --filter @executor-js/plugin-semantic-search test --
src/sdk/ai-search.test.ts src/sdk/plugin.test.ts
- bun run --filter @executor-js/plugin-semantic-search typecheck
- ./node_modules/.bin/oxfmt --check
packages/plugins/semantic-search/src/api/group.ts
packages/plugins/semantic-search/src/api/handlers.ts
packages/plugins/semantic-search/src/react/SearchPage.tsx
packages/plugins/semantic-search/src/sdk/ai-search.test.ts
packages/plugins/semantic-search/src/sdk/ai-search.ts
packages/plugins/semantic-search/src/sdk/documents.ts
packages/plugins/semantic-search/src/sdk/index.ts
packages/plugins/semantic-search/src/sdk/plugin.test.ts
packages/plugins/semantic-search/src/sdk/plugin.ts
packages/plugins/semantic-search/src/sdk/tool-search-backend.ts
- ./node_modules/.bin/oxlint -c .oxlintrc.jsonc
packages/plugins/semantic-search/src/api/group.ts
packages/plugins/semantic-search/src/api/handlers.ts
packages/plugins/semantic-search/src/react/SearchPage.tsx
packages/plugins/semantic-search/src/sdk/ai-search.test.ts
packages/plugins/semantic-search/src/sdk/ai-search.ts
packages/plugins/semantic-search/src/sdk/documents.ts
packages/plugins/semantic-search/src/sdk/index.ts
packages/plugins/semantic-search/src/sdk/plugin.test.ts
packages/plugins/semantic-search/src/sdk/plugin.ts
packages/plugins/semantic-search/src/sdk/tool-search-backend.ts
--deny-warnings

<!-- stack:links:start -->
### [Stack](https://github.com/aryasaatvik/stack)

1. **#69** 👈 current
2. #70
<!-- stack:links:end -->
@aryasaatvik aryasaatvik force-pushed the feat/semantic-search-make-embedder branch from 3fdfcc0 to ee8e9bf Compare June 27, 2026 14:01
@aryasaatvik aryasaatvik merged commit 7c71bae into dev Jun 27, 2026
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.

1 participant