---
title: Improve Ask AI answers with Mixedbread
description: Configure Mixedbread retrieval for a Geistdocs Ask AI chat and sync documentation to a site-specific Store
type: guide
summary: Provision a Mixedbread Store for one Geistdocs consumer site, enable semantic retrieval, and sync documentation during production builds.
url: /docs/mixedbread-retrieval
source: apps/template/content/docs/mixedbread-retrieval.mdx
prerequisites:
  - /docs/ask-ai
  - /docs/env
  - /docs/deployment
related:
  - /docs/configuration
  - /docs/llms-txt
---

# Improve Ask AI answers with Mixedbread

Mixedbread retrieval gives Ask AI the documentation passages that best match a user's question. The AI model stays the same, while semantic retrieval improves the evidence included with each question.

Geistdocs keeps the visible search dialog on its local Orama index. Mixedbread only changes the documentation retrieval used by Ask AI.

  Help me enable Mixedbread retrieval for this Geistdocs consumer site. Confirm that I am in this site's own repository and linked to the correct Vercel project before provisioning a Store. Then verify `siteId`, `ai.retrieval`, the search export route, the build script, and the `MXBAI` environment variables.

## How Mixedbread retrieval works

Ask AI searches documentation before sending a question to the configured AI model. The default local retriever matches keywords with Orama. Mixedbread adds semantic matching and returns the relevant content chunk instead of the start of a matching page.

The production build performs an incremental sync:

1. Next.js statically generates `/api/search/export` from the site's configured content sources.
2. `geistdocs search sync` uploads new or changed Markdown documents to the site's Mixedbread Store.
3. Ask AI queries the Store by `siteId` and locale.
4. Geistdocs falls back to the local Orama retriever if Mixedbread is unavailable or its credentials are missing at runtime.

Pages with `internal: true` or `excludeFrom: [chat]` are omitted from the export and removed from the Store on the next successful sync.

## Prerequisites

Before enabling Mixedbread retrieval, confirm that:

- The Mixedbread Marketplace integration is installed on your Vercel team.
- The consumer site has its own Vercel project.
- The consumer repository uses a Geistdocs release that includes `geistdocs search sync` and `createSearchExportRoute`.
- `source.config.ts` enables `includeProcessedMarkdown`, as generated Geistdocs projects do by default.
- `next.config.ts` enables `cacheComponents`, as generated Geistdocs projects do by default. Next.js must statically prerender `/api/search/export` before the sync command runs.

Use one Store per consumer site. Separate Stores isolate deployments and cleanup while keeping the same configuration in every repository.

## Provision a Store from the consumer repository

Run the Vercel integration command from the root of the **consumer site's repository**. Do not run it from the `geistdocs` package repository or from another docs site's repository.

The current directory must be linked to the Vercel project that deploys this consumer site. Check `.vercel/project.json`, or run `vercel link` and select the correct project before provisioning the Store:

```bash title="Terminal"
cd path/to/consumer-site-repository
vercel link
vercel integration add mixedbread \
  --name docs-my-product \
  --environment production
```

If the repository is a monorepo, run the command from the directory where you link the target Vercel project. The Vercel project's configured Root Directory can still point to the Geistdocs application inside that repository.

The command provisions one Mixedbread Store, connects it to the currently linked Vercel project, and pulls these environment variables:

- `MXBAI_API_KEY`: Authenticates server-side Mixedbread API requests.
- `MXBAI_STORE_ID`: Identifies this consumer site's Store.

Vercel prints a resource link after provisioning. Confirm the connection with:

```bash title="Terminal"
vercel integration list --integration mixedbread
```

## Configure the consumer site

Set a unique `siteId` and enable Mixedbread in the consumer repository's root `geistdocs.tsx` file:

```tsx title="geistdocs.tsx"
import type {
  GeistdocsAIConfig,
} from "@vercel/geistdocs/config";

export const siteId = "my-product-docs";

export const ai = {
  retrieval: "mixedbread",
} satisfies GeistdocsAIConfig;
```

The generated `lib/geistdocs/config.tsx` spreads `ai` into the package config. Keep `MXBAI_API_KEY` and `MXBAI_STORE_ID` out of `geistdocs.tsx` because that config is available to client components.

## Add the export route to an existing site

New Geistdocs projects include the export route. For an existing package-backed site, create this adapter:

```ts title="app/api/search/export/route.ts"
import { createSearchExportRoute } from "@vercel/geistdocs/routes/search-export";
import { config } from "@/lib/geistdocs/config";
import { geistdocsSource } from "@/lib/geistdocs/source";

export const { GET } = createSearchExportRoute({
  config,
  sources: [geistdocsSource],
});
```

Pass every configured source in `sources` when the site has multiple sections or documentation versions.

## Sync after each production build

New Geistdocs projects run the sync from their build script. For an existing site, update `package.json`:

```json title="package.json"
{
  "scripts": {
    "build": "next build && geistdocs search sync"
  }
}
```

Deploy the site to production. The first production build uploads every chat-visible page. Later builds upload changed pages and remove stale pages while leaving unrelated Store files untouched.

Local and preview builds skip the remote sync. To test a sync outside a production Vercel build, build the site and run the sync with the linked project's production environment variables:

```bash title="Terminal"
pnpm build
vercel env run --environment production -- \
  pnpm exec geistdocs search sync --allow-non-production
```

The sync command fails when Mixedbread retrieval is enabled for a production build but the Store environment variables are missing. The error prints the provisioning command and reminds you to run it from the correct consumer repository.

## Verify retrieval

Open the Mixedbread dashboard through Vercel and confirm that the Store contains one file per chat-visible documentation page:

```bash title="Terminal"
vercel integration open mixedbread
```

Ask a question that uses different words from the page title. Ask AI should cite the relevant page and answer from the matching section. If Mixedbread returns an error or exceeds the request timeout, Geistdocs logs a warning and retries the question with local Orama retrieval.
