Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
893 changes: 893 additions & 0 deletions src/components/AiSearchIndexingDiagram.astro

Large diffs are not rendered by default.

727 changes: 727 additions & 0 deletions src/components/AiSearchNamespacesDiagram.astro

Large diffs are not rendered by default.

478 changes: 478 additions & 0 deletions src/components/AiSearchOverviewDiagram.astro

Large diffs are not rendered by default.

853 changes: 853 additions & 0 deletions src/components/AiSearchQueryingDiagram.astro

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export { Icon as StarlightIcon } from "@astrojs/starlight/components";
export { Icon as AstroIcon } from "astro-icon/components";
// Custom components
export { default as AnchorHeading } from "./AnchorHeading.astro";
export { default as AiSearchIndexingDiagram } from "./AiSearchIndexingDiagram.astro";
export { default as AiSearchNamespacesDiagram } from "./AiSearchNamespacesDiagram.astro";
export { default as AiSearchOverviewDiagram } from "./AiSearchOverviewDiagram.astro";
export { default as AiSearchQueryingDiagram } from "./AiSearchQueryingDiagram.astro";
export { default as AnimatedWorkflowDiagram } from "./AnimatedWorkflowDiagram.astro";
export { default as AgentsPlatformDiagram } from "./AgentsPlatformDiagram.astro";
export { default as APIRequest } from "./APIRequest.astro";
Expand Down
1 change: 1 addition & 0 deletions src/components/landing/BuildFromScratch.astro
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const primitives = [
tags: [
{ label: "Workers AI", href: "/workers-ai/" },
{ label: "AI Gateway", href: "/ai-gateway/" },
{ label: "AI Search", href: "/ai-search/" },
{ label: "Agents", href: "/agents/" },
{ label: "Vectorize", href: "/vectorize/" },
{ label: "Browser Run", href: "/browser-run/" },
Expand Down
6 changes: 4 additions & 2 deletions src/content/docs/ai-search/concepts/how-ai-search-works.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ products:
- ai-search
---

import { AiSearchIndexingDiagram, AiSearchQueryingDiagram } from "~/components";

AI Search is a managed search service. Connect a website, an R2 bucket, or upload your own documents, and AI Search indexes your content for natural language queries.

AI Search consists of two core processes:
Expand All @@ -19,7 +21,7 @@ AI Search consists of two core processes:

Indexing begins automatically when you connect a data source or upload files through the [Items API](/ai-search/api/items/workers-binding/).

![Indexing](~/assets/images/ai-search/indexing.png)
<AiSearchIndexingDiagram />

Here is what happens during indexing:

Expand All @@ -36,7 +38,7 @@ For instances with a connected data source, AI Search regularly checks for updat

Once indexing is complete, AI Search is ready to respond to end-user queries in real time.

![Querying](~/assets/images/ai-search/querying.png)
<AiSearchQueryingDiagram />

Here is how the querying pipeline works:

Expand Down
18 changes: 11 additions & 7 deletions src/content/docs/ai-search/concepts/namespaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ products:
- ai-search
---

import { WranglerConfig } from "~/components";
import { AiSearchNamespacesDiagram, WranglerConfig } from "~/components";

Every AI Search instance belongs to a **namespace**. A namespace is a logical grouping of instances within your account.

<AiSearchNamespacesDiagram />

## Why use namespaces

Common reasons to use namespaces include:

- **Domain separation**: Separate instances by product area, for example `blog`, `support`, and `docs`.
- **Tenant isolation**: Assign each tenant their own namespace so that instance names do not collide across tenants.
- **Agent isolation**: Give each agent its own namespace for independent context management.

## Requirements

The namespace binding requires the following minimum package versions for TypeScript types and local development support.
Expand Down Expand Up @@ -86,12 +96,6 @@ namespace = "support"

</WranglerConfig>

### Common reasons to use multiple namespaces

- **Domain separation**: Separate instances by product area, for example `blog`, `support`, and `docs`.
- **Tenant isolation**: Assign each tenant their own namespace so that instance names do not collide across tenants.
- **Agent isolation**: Give each agent its own namespace for independent context management.

## Namespaces and instance uniqueness

An instance name must be unique within a namespace. This means you can have an instance named `docs` in both the `blog` and `support` namespaces without conflict.
1 change: 1 addition & 0 deletions src/content/docs/ai-search/configuration/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ You can customize how your AI Search instance indexes your data, retrieves resul
| [Generation model](/ai-search/configuration/models/) | yes | Model used to generate the final response |
| [Query rewriting model](/ai-search/configuration/models/) | yes | Model used for query rewriting |
| [Reranking model](/ai-search/configuration/models/) | yes | Model used to reorder results by semantic relevance |
| [AI Gateway](/ai-search/configuration/models/ai-gateway/) | yes | Observe and control the model calls AI Search makes |
43 changes: 43 additions & 0 deletions src/content/docs/ai-search/configuration/models/ai-gateway.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
pcx_content_type: concept
title: AI Gateway
description: Observe and control the AI models your AI Search instance uses through the connected AI Gateway.
sidebar:
order: 3
products:
- ai-search
---

Every AI Search instance is connected to a Cloudflare [AI Gateway](/ai-gateway/). The model calls that AI Search makes for embedding, query rewriting, reranking, and response generation run through this gateway. By configuring the connected gateway, you can observe and control those model calls.

To choose or change which gateway your instance uses, see [Models](/ai-search/configuration/models/).

## Observe your model calls

AI Gateway records the model requests that run through it, so you can see what your instance is doing.

- **[Analytics](/ai-gateway/observability/analytics/):** Track the number of requests, tokens used, cost, latency, and errors across your model calls.
- **[Logs](/ai-gateway/observability/logging/):** Inspect individual requests and responses, including the effective [system prompt](/ai-search/configuration/retrieval/system-prompt/), rewritten queries, and generated answers.

## Use models from other providers

By default, AI Search uses [Workers AI](/workers-ai/) models. To use models from other providers, such as OpenAI or Anthropic, add your provider keys to AI Gateway and select those models in AI Search.

1. Add your provider keys with [Bring Your Own Keys](/ai-gateway/configuration/bring-your-own-keys/).
2. Connect the gateway and select the models in your AI Search settings. For details, see [Models](/ai-search/configuration/models/).

## Guard against unsafe content

Use AI Gateway [Guardrails](/ai-gateway/features/guardrails/) to screen the prompts and responses that flow through your instance and block content that is unsafe or inappropriate. To detect and handle sensitive information, such as personal or financial data, use [Data Loss Prevention (DLP)](/ai-gateway/features/dlp/).

## Improve resilience

Configure [request retries and model fallbacks](/ai-gateway/configuration/fallbacks/) so that a model call can automatically retry or fall back to another model when a provider returns an error.

## Caching and rate limiting

Some AI Gateway features act on every request that passes through the gateway. Because your AI Search instance shares this gateway for its internal model calls, a few features can interfere with indexing and querying.

Do not turn on [AI Gateway caching](/ai-gateway/features/caching/) for the gateway connected to your AI Search instance. This matters most for embedding requests. AI Search relies on fresh embeddings to build its vector index and to match each query against it, so serving cached embeddings can store or return incorrect vectors and quietly degrade the accuracy of your search results. To cache search results, use AI Search's own [Similarity cache](/ai-search/configuration/retrieval/cache/) instead.

Similarly, avoid setting [rate limiting](/ai-gateway/features/rate-limiting/) on this gateway. Rate limits apply to AI Search's own model calls, including the many embedding requests made while indexing, and can interrupt indexing and querying.
3 changes: 3 additions & 0 deletions src/content/docs/ai-search/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ products:
---

import {
AiSearchOverviewDiagram,
CardGrid,
Description,
LinkTitleCard,
Expand All @@ -32,6 +33,8 @@ import {

AI Search lets you add search to any application or agent without having to build an entire retrieval infrastructure. Create an instance, give it your data, and search it with natural language.

<AiSearchOverviewDiagram />

You can use AI Search for:

- Documentation and knowledge base search
Expand Down
1 change: 1 addition & 0 deletions src/nimbus/components/landing/BuildFromScratch.astro
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const primitives = [
tags: [
{ label: "Workers AI", href: "/workers-ai/" },
{ label: "AI Gateway", href: "/ai-gateway/" },
{ label: "AI Search", href: "/ai-search/" },
{ label: "Agents", href: "/agents/" },
{ label: "Vectorize", href: "/vectorize/" },
{ label: "Browser Run", href: "/browser-run/" },
Expand Down