Search a portable image index in the browser with caption embeddings — no vector database.
Use this when you already have an exported image index and need to search it by meaning in the browser using caption embeddings.
Similar patterns, and when each one is the better fit.

Local Image IngestUse this when teaching or prototyping caption-then-embed for images and you want a downloadable index file as the result.
Local RAG IngestUse this when a small docs or knowledge-base prototype needs its text turned into embeddings held in React state and saved as a portable index.
Local RAG ChatUse this when you already have an exported embedding index of text chunks and want users to chat over it with cited, streamed answers.
Search - Exa AI (robust)FreeUse this when you want Exa search split into separate tools for news, Reddit, Wikipedia, and URLs, so the model picks the right source.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: AI_GATEWAY_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
AI_GATEWAY_API_KEYGet keyAI SDK APIs
embedcosineSimilarityExternal services
app/page.tsxapp/layout.tsxapp/api/query-embedding/route.tscomponents/local-image-search.tsxhooks/use-local-image-search.tslib/hash.tslib/caption-config.tslib/embedding-config.tslib/local-image-index.tslib/rate-limit.tslib/request-utils.tslib/retrieval.tslib/sample-index.tsfixtures/sample-image-index.jsonREADME.mdnpm packages
6
Registry components
lib/local-image-index.tsCopied V1 portable image-index contract. Must stay parity-tested against local-image-ingest. Reject incompatible schema/version/model/dimensions/caption identity before cosineSimilarity.
lib/retrieval.tsBrowser-side ranking with AI SDK Core cosineSimilarity. Keep ranking in the browser; never upload the full index to rank on the server. Dim below-threshold tiles instead of dropping them.
query-embedding/route.tsStateless Core embed boundary for one query string. Locked model openai/text-embedding-3-small with providerOptions.openai.dimensions=512. Never add @ai-sdk/openai solely for embeddings.
Search a portable image index in the browser with caption embeddings — no vector database.
Use this when you already have an exported image index and need to search it by meaning in the browser using caption embeddings.
Similar patterns, and when each one is the better fit.

Local Image IngestUse this when teaching or prototyping caption-then-embed for images and you want a downloadable index file as the result.
Local RAG IngestUse this when a small docs or knowledge-base prototype needs its text turned into embeddings held in React state and saved as a portable index.
Local RAG ChatUse this when you already have an exported embedding index of text chunks and want users to chat over it with cited, streamed answers.
Search - Exa AI (robust)FreeUse this when you want Exa search split into separate tools for news, Reddit, Wikipedia, and URLs, so the model picks the right source.Requirements, wiring steps, and what this pattern adds to your project.
Pick how you want to pull this pattern in. Then wire env vars and routes the same way.
Download → Next.js app
Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).
Extract the zip and install dependencies
Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.
Fill .env.local
The download includes .env.local placeholders when needed. Add real values for: AI_GATEWAY_API_KEY.
Customize the agent and tool files
Adapt prompts, tools, and stop conditions in the generated project for your product.
Run the app and open the pattern route
Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.
AI_GATEWAY_API_KEYGet keyAI SDK APIs
embedcosineSimilarityExternal services
app/page.tsxapp/layout.tsxapp/api/query-embedding/route.tscomponents/local-image-search.tsxhooks/use-local-image-search.tslib/hash.tslib/caption-config.tslib/embedding-config.tslib/local-image-index.tslib/rate-limit.tslib/request-utils.tslib/retrieval.tslib/sample-index.tsfixtures/sample-image-index.jsonREADME.mdnpm packages
6
Registry components
lib/local-image-index.tsCopied V1 portable image-index contract. Must stay parity-tested against local-image-ingest. Reject incompatible schema/version/model/dimensions/caption identity before cosineSimilarity.
lib/retrieval.tsBrowser-side ranking with AI SDK Core cosineSimilarity. Keep ranking in the browser; never upload the full index to rank on the server. Dim below-threshold tiles instead of dropping them.
query-embedding/route.tsStateless Core embed boundary for one query string. Locked model openai/text-embedding-3-small with providerOptions.openai.dimensions=512. Never add @ai-sdk/openai solely for embeddings.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Search a portable image index in the browser with caption embeddings — no vector database.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Search a portable image index in the browser with caption embeddings — no vector database.