You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Reranking and API-based system prompt configuration in AI Search
3
+
description: Improve result accuracy with reranking and dynamically control AI Search responses by setting system prompts in API requests.
4
+
products:
5
+
- ai-search
6
+
date: 2025-10-28
7
+
---
8
+
9
+
[AI Search](/ai-search/) now supports reranking for improved retrieval quality and allows you to set the system prompt directly in your API requests.
10
+
11
+
## Reranking for more relevant results
12
+
13
+
You can now enable [reranking](/ai-search/configuration/reranking/) to reorder retrieved documents based on their semantic relevance to the user’s query. Reranking helps improve accuracy, especially for large or noisy datasets where vector similarity alone may not produce the optimal ordering.
14
+
15
+
You can enable and configure reranking in the dashboard or directly in your API requests:
query:"How do I train a llama to deliver coffee?",
20
+
model:"@cf/meta/llama-3.3-70b-instruct-fp8-fast",
21
+
reranking: {
22
+
enabled:true,
23
+
model:"@cf/baai/bge-reranker-base"
24
+
}
25
+
});
26
+
```
27
+
28
+
## Set system prompts in API
29
+
30
+
Previously, [system prompts](/ai-search/configuration/system-prompt/) could only be configured in the dashboard. You can now define them directly in your API requests, giving you per-query control over behavior. For example:
31
+
32
+
```javascript
33
+
// Dynamically set query and system prompt in AI Search
Copy file name to clipboardExpand all lines: src/content/docs/ai-search/configuration/reranking.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ You can configure reranking in several ways:
25
25
26
26
### Configure via API
27
27
28
-
You can also configure via the API. When you make a `/search` or `/ai-search` request using the [Workers Binding](/ai-search/usage/workers-binding/) or [REST API](/ai-search/usage/rest-api/), you can:
28
+
When you make a `/search` or `/ai-search` request using the [Workers Binding](/ai-search/usage/workers-binding/) or [REST API](/ai-search/usage/rest-api/), you can:
Copy file name to clipboardExpand all lines: src/content/docs/ai-search/configuration/system-prompt.mdx
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,7 @@ System prompts are particularly useful for:
21
21
- Applying domain-specific tone or terminology
22
22
- Encouraging consistent, high-quality output
23
23
24
-
## How to set your system prompt
25
-
26
-
The system prompt for your AI Search can be set after it has been created by:
27
-
28
-
1. Navigating to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/ai/autorag), and go to AI > AI Search
29
-
2. Select your AI Search
30
-
3. Go to Settings page and find the System prompt setting for either Query rewrite or Generation
24
+
## System prompt configuration
31
25
32
26
### Default system prompt
33
27
@@ -39,6 +33,27 @@ You can view the effective system prompt used for any AI Search's model call thr
39
33
The default system prompt can change and evolve over time to improve performance and quality.
40
34
:::
41
35
36
+
### Configure via API
37
+
38
+
When you make a `/ai-search` request using the [Workers Binding](/ai-search/usage/workers-binding/) or [REST API](/ai-search/usage/rest-api/), you can set the system prompt programmatically.
query:"How do I train a llama to deliver coffee?",
45
+
model:"@cf/meta/llama-3.3-70b-instruct-fp8-fast",
46
+
system_prompt:"You are a helpful assistant."
47
+
});
48
+
```
49
+
50
+
### Configure via Dashboard
51
+
The system prompt for your AI Search can be set after it has been created by:
52
+
53
+
1. Navigating to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/ai/autorag), and go to AI > AI Search
54
+
2. Select your AI Search
55
+
3. Go to Settings page and find the System prompt setting for either Query rewrite or Generation
56
+
42
57
## Query rewriting system prompt
43
58
44
59
If query rewriting is enabled, you can provide a custom system prompt to control how the model rewrites user queries. In this step, the model receives:
Copy file name to clipboardExpand all lines: src/content/docs/r2/api/tokens.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ To create an API token:
20
20
1. In the Cloudflare dashboard, go to the **R2 object storage** page.
21
21
22
22
<DashButtonurl="/?to=/:account/r2/overview" />
23
-
2. Select **Manage API tokens**.
23
+
2. Select **Manage in API tokens**.
24
24
3. Choose to create either:
25
25
-**Create Account API token** - These tokens are tied to the Cloudflare account itself and can be used by any authorized system or user. Only users with the Super Administrator role can view or create them. These tokens remain valid until manually revoked.
26
26
-**Create User API token** - These tokens are tied to your individual Cloudflare user. They inherit your personal permissions and become inactive if your user is removed from the account.
Copy file name to clipboardExpand all lines: src/content/partials/ai-search/ai-search-api-params.mdx
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,10 @@ The input query.
12
12
13
13
The text-generation model that is used to generate the response for the query. For a list of valid options, check the AI Search Generation model Settings. Defaults to the generation model selected in the AI Search Settings.
0 commit comments