1
0
Fork 0

feat: update Ask AI docs (#2775)

* feat: add link to Ask AI Algolia docs

* docs: add dual SDK support to Ask AI API docs

* fix: ci

* docs: uniformize Ask AI copy

* fix
This commit is contained in:
Vasco Bettencourt 2025-10-05 23:43:03 +01:00 committed by GitHub
parent cd9e6fb3fb
commit 9986cbf426
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 80 additions and 75 deletions

View file

@ -1,16 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DocSearch v4 - Ask AI</title>
</head>
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DocSearch v4 - AskAI</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View file

@ -29,7 +29,7 @@ function App(): JSX.Element {
</section>
<section className="demo-section">
<p className="section-description">search with askai integration</p>
<p className="section-description">search with ask ai integration</p>
<div className="search-wrapper">
<BasicAskAI />
</div>

View file

@ -15,7 +15,7 @@ export default function BasicAskAI(): JSX.Element {
},
}}
insights={true}
translations={{ button: { buttonText: 'Search with AskAI' } }}
translations={{ button: { buttonText: 'Search with Ask AI' } }}
/>
);
}

View file

@ -703,7 +703,7 @@ assistive tech users */
gap: 8px;
}
/* AskAI Button */
/* Ask AI Button */
.DocSearch-Hit-AskAIButton {
color: var(--docsearch-text-color);

View file

@ -29,7 +29,7 @@ export type DocSearchTransformClient = {
transporter: Pick<LiteClient['transporter'], 'algoliaAgent'>;
};
// Define the specific search parameters allowed for AskAI
// Define the specific search parameters allowed for Ask AI
export type AskAiSearchParameters = {
facetFilters?: string[];
filters?: string;

View file

@ -624,7 +624,7 @@ export function DocSearchModal({
onClose,
});
// AskAI source
// Ask AI source
const askAiSource: Array<AutocompleteSource<InternalDocSearchHit>> = canHandleAskAi
? [
{

View file

@ -140,7 +140,7 @@ export function SearchBox({
}, [props.askAiStatus, props.inputRef]);
/**
* We need to block the default behavior of the input when AskAI is active.
* We need to block the default behavior of the input when Ask AI is active.
* This is because the input is used to ask another question when the user presses enter.
*
* Learn more on default autocomplete behavior:
@ -150,7 +150,7 @@ export function SearchBox({
...baseInputProps,
enterKeyHint: props.isAskAiActive ? ('enter' as const) : ('search' as const),
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>): void => {
// block these up, down, enter listeners when AskAI is active
// block these up, down, enter listeners when Ask AI is active
if (props.isAskAiActive && blockedKeys.has(e.key)) {
// enter key asks another question
if (e.key === 'Enter' && !isAskAiStreaming && props.state.query) {
@ -165,7 +165,7 @@ export function SearchBox({
onChange: (e: React.ChangeEvent<HTMLInputElement>): void => {
if (props.isAskAiActive) {
props.setQuery(e.currentTarget.value);
// block search when AskAI is active
// block search when Ask AI is active
// we don't want to trigger the search when the user types
// we already know they are asking a question
e.preventDefault();

View file

@ -241,7 +241,7 @@ in case you want to use different credentials for askAi
</TabItem>
</Tabs>
:::tip AskAI supports these essential search parameters for optimal performance:
:::tip Ask AI supports these essential search parameters for optimal performance:
- **Filtering**: `facetFilters: ['type:content']` - Filter by language, version, or content type
- **Complex filtering**: `filters: 'type:content AND language:en'` - Apply complex filtering rules
@ -249,7 +249,7 @@ in case you want to use different credentials for askAi
- **Search scope**: `restrictSearchableAttributes: ['title', 'content']` - Limit search to specific fields
- **Deduplication**: `distinct: true` - Remove duplicate results
These parameters provide the essential functionality for AskAI while keeping the API simple and focused. :::
These parameters provide the essential functionality for Ask AI while keeping the API simple and focused. :::
## `searchParameters`

View file

@ -181,11 +181,11 @@ docsearch({
Or use our new dedicated [DocSearch Playground](https://community.algolia.com/docsearch-playground/)
### Using DocSearch with AskAI
### Using DocSearch with Ask AI
DocSearch v4 introduces support for AskAI, Algolias advanced, AI-powered search capability. AskAI enhances the user experience by providing contextually relevant and intelligent responses directly from your documentation.
DocSearch v4 introduces support for Ask AI, Algolia's advanced, AI-powered search capability. Ask AI enhances the user experience by providing contextually relevant and intelligent responses directly from your documentation.
To enable AskAI, you can add your Algolia Assistant ID as a string, or use an object for more advanced configuration (such as specifying a different index, credentials, or search parameters):
To enable Ask AI, you can add your Algolia Assistant ID as a string, or use an object for more advanced configuration (such as specifying a different index, credentials, or search parameters):
<Tabs groupId="askai-format" defaultValue="string" values={[{ label: 'String', value: 'string' }, { label: 'Object', value: 'object' }]}>
<TabItem value="string">
@ -208,12 +208,12 @@ docsearch({
indexName: 'YOUR_INDEX_NAME',
apiKey: 'YOUR_SEARCH_API_KEY',
askAi: {
indexName: 'YOUR_MARKDOWN_INDEX', // Optional: use a different index for AskAI
apiKey: 'YOUR_SEARCH_API_KEY', // Optional: use a different API key for AskAI
appId: 'YOUR_APP_ID', // Optional: use a different App ID for AskAI
indexName: 'YOUR_MARKDOWN_INDEX', // Optional: use a different index for Ask AI
apiKey: 'YOUR_SEARCH_API_KEY', // Optional: use a different API key for Ask AI
appId: 'YOUR_APP_ID', // Optional: use a different App ID for Ask AI
assistantId: 'YOUR_ALGOLIA_ASSISTANT_ID',
searchParameters: {
facetFilters: ['language:en', 'version:1.0.0'], // Optional: filter AskAI context
facetFilters: ['language:en', 'version:1.0.0'], // Optional: filter Ask AI context
},
},
});
@ -223,7 +223,7 @@ docsearch({
</Tabs>
- Use the string form for a simple setup.
- Use the object form to customize which index, credentials, or filters AskAI uses.
- Use the object form to customize which index, credentials, or filters Ask AI uses.
### Filtering search results
@ -267,12 +267,12 @@ docsearch({
</Tabs>
#### AskAI
#### Ask AI
Filtering also applies when using AskAI. This is useful to limit the scope of the LLM's search to only relevant results.
Filtering also applies when using Ask AI. This is useful to limit the scope of the LLM's search to only relevant results.
:::info
We recommend using the `facetFilters` option when using AskAI with multiple languages or any multi-faceted index.
We recommend using the `facetFilters` option when using Ask AI with multiple languages or any multi-faceted index.
:::
<Tabs
@ -312,7 +312,7 @@ docsearch({
</Tabs>
:::tip
You can use `facetFilters: ['type:content']` to ensure AskAI only uses records where the `type` attribute is `content` (i.e., only records that actually have content). This is useful if your index contains records for navigation, metadata, or other non-content types.
You can use `facetFilters: ['type:content']` to ensure Ask AI only uses records where the `type` attribute is `content` (i.e., only records that actually have content). This is useful if your index contains records for navigation, metadata, or other non-content types.
:::
### Sending events

View file

@ -348,5 +348,5 @@ the snippet below maps a non-standard record to the internal format. try it live
## Tips
- **Instrumentation**: enable `insights` to send usage analytics and iterate on relevance.
- **AskAI scoping**: use `facetFilters`, `filters`, `attributesToRetrieve`, `restrictSearchableAttributes`, and `distinct` to control ai context and improve answer quality.
- **Ask AI scoping**: use `facetFilters`, `filters`, `attributesToRetrieve`, `restrictSearchableAttributes`, and `distinct` to control ai context and improve answer quality.
- **Customization**: use `hitComponent`, `transformItems`, and `translations` to make docsearch feel native to any product surface.

View file

@ -22,11 +22,11 @@ We refreshed a few translations keys to make their purpose much clearer:
Find the full list of translations in the [API documentation](/docs/api#translations)
## Integrating AskAI with DocSearch v4
## Integrating Ask AI with DocSearch v4
### Basic Integration
DocSearch v4 introduces seamless support for Algolia's AskAI feature. To enable AI-powered search, add the `askAi` parameter with your Algolia Assistant ID to your existing DocSearch configuration:
DocSearch v4 introduces seamless support for Algolia's Ask AI feature. To enable AI-powered search, add the `askAi` parameter with your Algolia Assistant ID to your existing DocSearch configuration:
```javascript
docsearch({
@ -37,11 +37,11 @@ docsearch({
});
```
Replace `YOUR_ALGOLIA_ASSISTANT_ID` with the ID provided from your Algolia Dashboard under the AskAI section.
Replace `YOUR_ALGOLIA_ASSISTANT_ID` with the ID provided from your Algolia Dashboard under the Ask AI section.
### Advanced Integration (Using a Separate Index)
If you prefer to utilize AskAI with a separate configuration from your main DocSearch setup (for instance, using different API credentials or index), you can do so by providing an object to the `askAi` parameter:
If you prefer to utilize Ask AI with a separate configuration from your main DocSearch setup (for instance, using different API credentials or index), you can do so by providing an object to the `askAi` parameter:
```javascript
docsearch({
@ -59,7 +59,7 @@ docsearch({
Ensure each field (`indexName`, `apiKey`, `appId`, and `assistantId`) within the `askAi` object is correctly configured for the Algolia index and assistant you wish to use.
## Features in v4 with AskAI
## Features in v4 with Ask AI
* **BYO-LLM (Bring Your Own LLM) Support**: You can integrate custom AI models by providing your own LLM keys and configurations.
* **Improved Security**: Short-lived tokens and domain verification enhance security, reducing unauthorized access.
@ -75,13 +75,13 @@ DocSearch v4 provides a clear migration path:
* Update your DocSearch configuration with the new `askAi` settings as required.
* Ensure domain whitelist and assistant settings are properly configured via your Algolia Dashboard.
* Review your indexed content and analytics periodically to optimize AskAI responses and performance.
* Review your indexed content and analytics periodically to optimize Ask AI responses and performance.
For full details on endpoint security, caching strategies, and infrastructure, see the dedicated [Security and Infrastructure](https://algolia.com/doc/) documentation.
## Support and Resources
* **AskAI documentation**: Learn everything about Algolia AskAI ([Documentation](/#)).
* **Ask AI documentation**: Learn everything about Algolia Ask AI ([Documentation](/#)).
* **DocSearch Playground**: Interactive environment to test DocSearch configurations ([Docsearch Playground](https://community.algolia.com/docsearch-playground/)).
* **Community & Support**: Reach out through the [Algolia Discord](https://alg.li/discord).

View file

@ -4,7 +4,9 @@ title: Ask AI API Reference
The Ask AI API enables developers to build custom chat interfaces powered by Algolia's AI assistant. Use these endpoints to create tailored conversational experiences that search your Algolia index and generate contextual responses using your own LLM provider.
:::info This API documentation is primarily for developers building custom Ask AI integrations. If you're using the DocSearch package, you typically won't need this information since DocSearch handles the Ask AI API integration automatically. For standard DocSearch usage, see the [DocSearch documentation](/docs/docsearch) instead. :::
:::info
This API documentation is primarily for developers building custom Ask AI integrations. If you're using the DocSearch package, you typically won't need this information since DocSearch handles the Ask AI API integration automatically. For standard DocSearch usage, see the [DocSearch documentation](/docs/docsearch) instead.
:::
## API Documentation
@ -21,4 +23,4 @@ The official documentation includes:
- Integration examples with Next.js and Vercel AI SDK
- Error handling and best practices
For more information about Ask AI in general, see the [Ask AI documentation](/docs/v4/askai.mdx).
For more information about Ask AI in general, see the [Ask AI documentation](/docs/v4/askai).

View file

@ -2,7 +2,7 @@
title: Improving Answer Quality with Markdown Indexing
---
To deliver more accurate, context-rich answers at scale, AskAI benefits from cleanly structured content. One of the most effective ways to achieve this is by using a Markdown-based indexing helper in your Algolia Crawler configuration. This setup ensures AskAI can access well-formed, content-focused records—especially important for larger documentation sites where metadata, navigation elements, or layout artifacts might otherwise dilute the quality of generative responses.
To deliver more accurate, context-rich answers at scale, Ask AI benefits from cleanly structured content. One of the most effective ways to achieve this is by using a Markdown-based indexing helper in your Algolia Crawler configuration. This setup ensures Ask AI can access well-formed, content-focused records—especially important for larger documentation sites where metadata, navigation elements, or layout artifacts might otherwise dilute the quality of generative responses.
:::info
Setting up markdown indexing can be automated through the Crawler UI for most use cases. For advanced customization or understanding the underlying configuration, manual setup options are also available.
@ -11,7 +11,7 @@ Setting up markdown indexing can be automated through the Crawler UI for most us
:::
## Overview
To maximize the quality of AskAI responses, configure your Crawler to create a dedicated index for Markdown content. This approach enables AskAI to work with structured, chunked records sourced from your documentation, support content, or any Markdown-based material—resulting in significantly more relevant and precise answers.
To maximize the quality of Ask AI responses, configure your Crawler to create a dedicated index for Markdown content. This approach enables Ask AI to work with structured, chunked records sourced from your documentation, support content, or any Markdown-based material—resulting in significantly more relevant and precise answers.
You can set up markdown indexing in two ways:
1. **Automated Setup (Recommended)**: Use the Crawler UI to automatically create and configure your markdown index
@ -21,7 +21,7 @@ You can set up markdown indexing in two ways:
## Automated Markdown Indexing Setup (Recommended)
The easiest way to set up markdown indexing is through the Crawler UI, which automatically creates and configures an optimized markdown index for AskAI.
The easiest way to set up markdown indexing is through the Crawler UI, which automatically creates and configures an optimized markdown index for Ask AI.
### Step 1: Access Markdown Indexing in Crawler Configuration
@ -50,7 +50,7 @@ The easiest way to set up markdown indexing is through the Crawler UI, which aut
The Crawler will automatically configure the optimal settings for your chosen template, including:
- Proper record extraction and chunking
- Framework-specific metadata extraction (language, version, tags)
- Optimized index settings for AskAI
- Optimized index settings for Ask AI
### Step 3: Run the Crawler
@ -58,13 +58,13 @@ Once your markdown index is configured:
1. Click **"Start Crawling"** to begin indexing your content
2. Monitor the crawl progress in the dashboard
3. Your new markdown index will be populated with clean, structured records optimized for AskAI
3. Your new markdown index will be populated with clean, structured records optimized for Ask AI
![Crawler Status](/img/assets/askai-crawling.png)
### Step 4: Integrate with AskAI
### Step 4: Integrate with Ask AI
After crawling completes, configure DocSearch to use your new markdown index for AskAI responses. See the [Integration section](#integrate-your-new-index-with-ask-ai) below for detailed setup instructions.
After crawling completes, configure DocSearch to use your new markdown index for Ask AI responses. See the [Integration section](#integrate-your-new-index-with-ask-ai) below for detailed setup instructions.
---
@ -129,7 +129,7 @@ After updating your Crawler configuration:
1. **Publish your configuration** in the Algolia Crawler dashboard to save and activate it.
2. **Run the Crawler** to index your markdown content and create the new index.
The Crawler will process your content using the markdown extraction helper and populate your new index with clean, structured records optimized for AskAI.
The Crawler will process your content using the markdown extraction helper and populate your new index with clean, structured records optimized for Ask AI.
> **Tip:** Monitor the crawl progress in your dashboard to ensure all pages are processed correctly. You can view the indexed records in your Algolia index to verify the structure and content.
@ -351,18 +351,18 @@ const searchParameters = {
## Best Practices & Tips
- **Use clear, consistent titles in your markdown files** for better searchability.
- **Test your index** with AskAI to ensure relevant answers are returned.
- **Test your index** with Ask AI to ensure relevant answers are returned.
- **Adjust `maxRecordBytes`** if you notice answers are too broad or too fragmented.
- **Note:** Increasing `maxRecordBytes` may increase the token count for LLMs, which can affect the size of the context window and the cost of each AskAI response.
- **Note:** Increasing `maxRecordBytes` may increase the token count for LLMs, which can affect the size of the context window and the cost of each Ask AI response.
- **Keep your markdown well-structured** (use headings, lists, etc.) for optimal chunking.
- **Add attributes** like `lang`, `version`, or `tags` to your records and `attributesForFaceting` if you want to filter or facet in your search UI or AskAI.
- **Add attributes** like `lang`, `version`, or `tags` to your records and `attributesForFaceting` if you want to filter or facet in your search UI or Ask AI.
---
## FAQ
**Q: Why use a separate markdown index?**
A: It allows AskAI to access content in a format optimized for LLMs, improving answer quality.
A: It allows Ask AI to access content in a format optimized for LLMs, improving answer quality.
**Q: Can I use this with other content types?**
A: Yes, but markdown is especially well-suited for chunking and context extraction.
@ -372,7 +372,7 @@ A: Lower the `maxRecordBytes` value to split content into smaller, more focused
---
For more details, see the [AskAI documentation](./askai.mdx) or contact support if you need help configuring your Crawler.
For more details, see the [Ask AI documentation](./askai.mdx) or contact support if you need help configuring your Crawler.
---
@ -593,4 +593,4 @@ import TabItem from '@theme/TabItem';
</Tabs>
> Each example shows how to extract common facets and configure your markdown index for AskAI. Adjust selectors and meta tag names as needed for your site.
> Each example shows how to extract common facets and configure your markdown index for Ask AI. Adjust selectors and meta tag names as needed for your site.

View file

@ -4,6 +4,6 @@ title: Bring Your Own LLM
import { ProvidersTable } from '../../src/components/ProvidersTable'
AskAI currently supports a Bring Your Own LLM (BYOLLM) model selection, allowing you to connect your preferred provider.
Ask AI currently supports a Bring Your Own LLM (BYOLLM) model selection, allowing you to connect your preferred provider.
<ProvidersTable />

View file

@ -2,7 +2,7 @@
title: Whitelisted domains
---
DocSearch AskAI can only run on domains or domain patterns explicitly allowed (whitelisted). Domains not listed here will not be permitted to use AskAI, ensuring security and preventing unauthorized use. You can manage this list at any time.
DocSearch Ask AI can only run on domains or domain patterns explicitly allowed (whitelisted). Domains not listed here will not be permitted to use Ask AI, ensuring security and preventing unauthorized use. You can manage this list at any time.
Use wildcards (`*`) to easily match multiple subdomains, for example:
@ -10,7 +10,7 @@ Use wildcards (`*`) to easily match multiple subdomains, for example:
## Adding a Domain
To allow AskAI on a new domain:
To allow Ask AI on a new domain:
1. Navigate to **Data Sources > Ask AI** in your Algolia Dashboard.
2. Click **Add Domain**.
@ -21,11 +21,11 @@ New domains are activated immediately.
## Removing a Domain
To revoke AskAI permissions from a domain:
To revoke Ask AI permissions from a domain:
1. Navigate to **Data Sources > Ask AI** in your Algolia Dashboard.
2. Locate the domain you wish to remove.
3. Click the **Remove** button next to the domain.
4. Confirm your action.
The domain will be removed immediately, disabling AskAI access.
The domain will be removed immediately, disabling Ask AI access.

View file

@ -1,26 +1,26 @@
---
title: Get started with AskAI
title: Get started with Ask AI
---
import useBaseUrl from '@docusaurus/useBaseUrl';
## Overview
AskAI is a conversational AI product that lets you connect your own Large Language Model (LLM) provider (such as OpenAI, Anthropic, Mistral, and more) using your own API keys and model choice. It enables you to use LLMs with the context of your own Algolia index—so your users can ask anything and get answers grounded in your documentation, support articles, or any content you index with Algolia.
Ask AI is a conversational AI product that lets you connect your own Large Language Model (LLM) provider (such as OpenAI, Anthropic, Mistral, and more) using your own API keys and model choice. It enables you to use LLMs with the context of your own Algolia index—so your users can ask anything and get answers grounded in your documentation, support articles, or any content you index with Algolia.
- **Bring Your Own LLM (BYOLLM):** Choose your provider and model, supply your own API keys.
- **Index-Aware AI:** AskAI uses your Algolia index as the context for the LLM.
- **Index-Aware AI:** Ask AI uses your Algolia index as the context for the LLM.
- **Works with Any Index:** Use with documentation, blogs, support, product data, and more.
## Why you should use AskAI
## Why you should use Ask AI
- **Reduce support workload:** Deflect repetitive questions and let users self-serve with AI-powered answers.
- **Boost user satisfaction:** Provide fast, conversational help directly from your content.
- **Easy to launch and maintain:** No retraining, no manual tagging—just connect your index and go.
- **Customizable for your needs:** Adapt prompts, tone, and model to your brand and audience.
- **Future-proof:** As your content or LLM provider evolves, AskAI adapts with you.
- **Future-proof:** As your content or LLM provider evolves, Ask AI adapts with you.
To get started with AskAI on your site, begin by creating and configuring your Ask AI assistant—including its model, prompt, and allowed domains where Ask AI should run.
To get started with Ask AI on your site, begin by creating and configuring your Ask AI assistant—including its model, prompt, and allowed domains where Ask AI should run.
1. Go to **Data Sources > Ask AI**.
2. Click **"Create Your Assistant"** to start setting up your Ask AI service.
@ -69,7 +69,7 @@ Set up the core components of your assistant, including the language model, auth
Now it's time to set up the **system prompt**—this tells the LLM how it should respond using your content. The system prompt shapes your assistant's tone, style, and behavior.
AskAI provides **three default prompt templates** to help you get started. You can:
Ask AI provides **three default prompt templates** to help you get started. You can:
* **Use a pre-built prompt**: Quickly launch with a default configuration.
* **Customize an existing prompt**: Adjust the wording to better fit your tone or use case.
@ -118,5 +118,5 @@ This view gives you a centralized place to organize, reuse, and fine-tune your a
## Next steps
- [Prompting with AskAI](/docs/v4/askai-prompts)
- [AskAI Whitelisted Domains](/docs/v4/askai-whitelisted-domains)
- [Prompting with Ask AI](/docs/v4/askai-prompts)
- [Ask AI Whitelisted Domains](/docs/v4/askai-whitelisted-domains)

View file

@ -134,7 +134,7 @@ export default {
announcementBar: {
id: 'announcement-bar',
content:
'🚀 Get AskAI now! Turn your docs site search into an AI-powered assistant faster answers, fewer tickets, better self-serve. <a target="_blank" rel="noopener noreferrer" href="https://dashboard.algolia.com/ask-ai">Get Started Now</a>',
'🚀 Get Ask AI now! Turn your docs site search into an AI-powered assistant faster answers, fewer tickets, better self-serve. <a target="_blank" rel="noopener noreferrer" href="https://dashboard.algolia.com/ask-ai">Get Started Now</a>',
},
colorMode: {
defaultMode: 'light',

View file

@ -23,7 +23,7 @@ export default {
},
{
type: 'category',
label: 'Algolia AskAI',
label: 'Algolia Ask AI',
items: [
'v4/askai',
'v4/askai-api',
@ -32,6 +32,11 @@ export default {
'v4/askai-models',
'v4/askai-markdown-indexing',
'v4/askai-errors',
{
type: 'link',
label: 'Full Documentation',
href: 'https://www.algolia.com/doc/guides/algolia-ai/askai',
},
],
},
{