ENF News Bot
Automated News Bot
- Joined
- Apr 15, 2022
- Messages
- 2,591
AI Search now supports reranking for improved retrieval quality and allows you to set the system prompt directly in your API requests.
You can now enable 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.
You can enable and configure reranking in the dashboard or directly in your API requests:
Previously, system prompts 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:
Learn more about Reranking and System Prompt in AI Search.
Continue reading...
Rerank for more relevant results
https://developers.cloudflare.com/changelog/rss/#rerank-for-more-relevant-resultsYou can now enable 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.
You can enable and configure reranking in the dashboard or directly in your API requests:
Code:
const answer = await env.AI.autorag("my-autorag").aiSearch({
query: "How do I train a llama to deliver coffee?",
model: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
reranking: {
enabled: true,
model: "@cf/baai/bge-reranker-base",
},
});
Set system prompts in API
https://developers.cloudflare.com/changelog/rss/#set-system-prompts-in-apiPreviously, system prompts 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:
Code:
// Dynamically set query and system prompt in AI Search
async function getAnswer(query, tone) {
const systemPrompt = `You are a ${tone} assistant.`;
const response = await env.AI.autorag("my-autorag").aiSearch({
query: query,
system_prompt: systemPrompt,
});
return response;
}
// Example usage
const query = "What is Cloudflare?";
const tone = "friendly";
const answer = await getAnswer(query, tone);
console.log(answer);
Learn more about Reranking and System Prompt in AI Search.
Continue reading...