Discover themes in comments with no labels up front. Embeddings pick likely pairs, Jev answers one boolean per pair, and code does the grouping.
Use this when you have a pile of comments, tickets, or survey answers and need to discover the themes in them before any categories exist.
Similar patterns, and when each one is the better fit.

Jev Email TagsUse this when you are multi-label tagging a known set of messages, such as an inbox, without writing a classifier prompt or allowing invented labels.
Jev Search FilterFreeUse this when you want semantic search over a known catalog, such as emoji or icons, without building embeddings, scoring each item with a boolean.
Jev Table QueryUse this when users type filter or sort requests over a fixed table, with column sorts run in code and other phrases scored by the model per row.
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.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
experimental_evaluateembedManygenerateTextgatewayProviders
External services
app/page.tsxapp/layout.tsxapp/api/cluster/route.tscomponents/clustering-demo.tsxcomponents/comment-thread.tsxcomponents/result-header.tsxcomponents/theme-list.tsxcomponents/typesafe-ai.tsxhooks/use-clustering.tslib/comments.tslib/candidate-pairs.tslib/pair-questions.tslib/pair-evaluation.tslib/cluster-graph.tslib/theme-labels.tslib/cluster-pipeline.tslib/result-copy.tslib/rate-limit.tslib/request-utils.tsREADME.mdnpm packages
6
Registry components
lib/cluster-pipeline.tsclusterComments is the whole pipeline: embedMany, candidatePairs, evaluatePairs, clusterLinks, then names. The same clusterLinks call runs over raw cosine similarity to produce the embeddings-only baseline. Embedding, Jev model, and naming are injectable so tests never touch the network.
lib/cluster-graph.tsPure average-linkage clustering over compared pairs only. An uncompared pair is unknown, not zero. A merge needs two compared pairs unless only one pair exists, and validateCohesion ejects members under the floor. Do not replace this with connected components: one loose chain would merge unrelated themes.
lib/candidate-pairs.tscandidatePairs keeps a pair when either comment ranks the other in its six nearest neighbors. This bounds what Jev is asked so pair count grows with the collection, not its square.
lib/pair-evaluation.tsevaluatePairs asks one Jev boolean per candidate pair in batches of 40 with bounded concurrency and zeroDataRetention. A pair with no usable probability stays uncompared and is never treated as a match.
lib/pair-questions.tsbuildPairQuestions and THEME_FLOOR (0.50). The same-theme criteria define the granularity of the themes. Change the criteria, not the clustering code, to make themes broader or narrower.
lib/theme-labels.tsTheme names are enrichment from generateText with reasoning off. cleanLabel trims model text to one short plain line and a failed name falls back to Theme N. Names never change membership.
Discover themes in comments with no labels up front. Embeddings pick likely pairs, Jev answers one boolean per pair, and code does the grouping.
Use this when you have a pile of comments, tickets, or survey answers and need to discover the themes in them before any categories exist.
Similar patterns, and when each one is the better fit.

Jev Email TagsUse this when you are multi-label tagging a known set of messages, such as an inbox, without writing a classifier prompt or allowing invented labels.
Jev Search FilterFreeUse this when you want semantic search over a known catalog, such as emoji or icons, without building embeddings, scoring each item with a boolean.
Jev Table QueryUse this when users type filter or sort requests over a fixed table, with column sorts run in code and other phrases scored by the model per row.
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.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
experimental_evaluateembedManygenerateTextgatewayProviders
External services
app/page.tsxapp/layout.tsxapp/api/cluster/route.tscomponents/clustering-demo.tsxcomponents/comment-thread.tsxcomponents/result-header.tsxcomponents/theme-list.tsxcomponents/typesafe-ai.tsxhooks/use-clustering.tslib/comments.tslib/candidate-pairs.tslib/pair-questions.tslib/pair-evaluation.tslib/cluster-graph.tslib/theme-labels.tslib/cluster-pipeline.tslib/result-copy.tslib/rate-limit.tslib/request-utils.tsREADME.mdnpm packages
6
Registry components
lib/cluster-pipeline.tsclusterComments is the whole pipeline: embedMany, candidatePairs, evaluatePairs, clusterLinks, then names. The same clusterLinks call runs over raw cosine similarity to produce the embeddings-only baseline. Embedding, Jev model, and naming are injectable so tests never touch the network.
lib/cluster-graph.tsPure average-linkage clustering over compared pairs only. An uncompared pair is unknown, not zero. A merge needs two compared pairs unless only one pair exists, and validateCohesion ejects members under the floor. Do not replace this with connected components: one loose chain would merge unrelated themes.
lib/candidate-pairs.tscandidatePairs keeps a pair when either comment ranks the other in its six nearest neighbors. This bounds what Jev is asked so pair count grows with the collection, not its square.
lib/pair-evaluation.tsevaluatePairs asks one Jev boolean per candidate pair in batches of 40 with bounded concurrency and zeroDataRetention. A pair with no usable probability stays uncompared and is never treated as a match.
lib/pair-questions.tsbuildPairQuestions and THEME_FLOOR (0.50). The same-theme criteria define the granularity of the themes. Change the criteria, not the clustering code, to make themes broader or narrower.
lib/theme-labels.tsTheme names are enrichment from generateText with reasoning off. cleanLabel trims model text to one short plain line and a failed name falls back to Theme N. Names never change membership.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Discover themes in comments with no labels up front. Embeddings pick likely pairs, Jev answers one boolean per pair, and code does the grouping.
Loading preview…
Early-bird pricing — limited time


Open on desktop for the interactive preview.
Discover themes in comments with no labels up front. Embeddings pick likely pairs, Jev answers one boolean per pair, and code does the grouping.