# AI ask box widget

## Overview

> info  **PREREQUISITES**:
>
> * This widget is available out of the box as of version Sitefinity CMS 15.4.8626. For older supported versions, you can use the custom widget samples.
> * A Progress Agentic RAG account is required to manage knowledge boxes.

The *AI ask box* widget provides a natural-language input box for visitors to submit queries. The *AI ask box* initiates the search request and passes the query to Progress Agentic RAG via the Sitefinity proxy endpoint. Typically you place it on a landing page or search page. The widget then redirects users to a results page containing the *AI answer* and *AI search results* widgets.

The *AI answer* and *AI search results* widgets use only content from the current site and in the current language.

## Configuration options

### **AI ask box setup**

In *AI ask box* setup section, you can do the following:

* **Agentic RAG connection**   - A connection to a specific knowledge box in Progress Agentic RAG. Select which connection this widget should use to search and answer questions. You can manage connections in Administration » Progress Agentic RAG connections.
* **Search Configuration**   -  A saved set of search settings that the AI uses to find content. You can find them in the Progress Agentic RAG portal, in Search » Saved configurations.\
  The *AI ask box* passes the selected configuration to all AI Search widgets on the page that displays the results. If you do not select a configuration, you can place the *AI answer* and *AI search results* widgets on the same page. If you select a custom configuration, its search mode must match the widget on the results page - `search` mode for the *AI search results* widget or `simple-rag` mode for the *AI answer* widget. In this case, place the two widgets on separate pages, each with its own *AI ask box*.\
  For more information, see [AI Search](https://www.progress.com/documentation/sitefinity-cms/ai-search#search-configurations-and-widget-placement).
* **After search is submitted... -**  Select whether you want to stay on the same page or designate a page to redirect to when displaying the answer. The page where the answer is displayed must contain the *AI answer* and/or the *AI search results* widget.
* **Suggestions**   - These are example questions or phrases displayed under the *AI ask* *box*.

### Knowledge scope

> info **PREREQUISITES**: This feature is available as of Sitefinity CMS product update 15.4.8641.

In the *Knowledge scope* section, you can limit the content that the AI uses to answer questions and to return search results:

* **Base answers on...** - Select *All content types* or *Selected types*.\
  If you choose *Selected types*, click the box below and select the content types from the list. To see all content types, click *Show all content types*.\
  If you select multiple content types, the AI uses content of any of the selected types.
* **Content modified** - Select which content to use, based on the date when it was last modified:

  * *Any time* - Use all content.
  * *Last...* - Enter a number and select *day(s)*, *week(s)*, *month(s)*, or *year(s)*. Only content modified within this period is used.
  * *After...* - Select a date. Only content modified after this date is used.

  The *Last...* period is calculated from the current date, each time a visitor submits a question.

The *AI ask box* passes these settings to the *AI answer* and *AI search results* widgets that display the results.

The *Knowledge scope* section is available only when you select the *System connection* or a connection that you created in *Administration » Progress Agentic RAG connections*.

You can achieve the same filtering with a search configuration in the Progress Agentic RAG portal. The *Knowledge scope* section lets you do this directly in the widget. You can also use the *Knowledge scope* together with a search configuration. In this case, the *Knowledge scope* filters are applied in addition to the search configuration.

### Display settings

In the *Display setting* section, you can do the following:

* **Change the template**\
  To change the template that the *AI ask box* widget uses, select the new template in the *AI ask box* template dropdown box.\
  You must first have created a custom template.\
  For more information, see [Next.js pages and templates](https://www.progress.com/documentation/sitefinity-cms/next.js-pages-and-templates) and [ASP.NET Core pages and templates](https://www.progress.com/documentation/sitefinity-cms/create-an-asp.net-core-page).
* **Configure the widget margins**\
  In Margins, you can choose the margins between the text and the column where it is placed.\
  Choose from the predefined values of none, small, medium, or large.

### Advanced widget settings

To open the advanced settings, in the upper-right corner of the *AI ask box* page, click ![Settings](https://www.progress.com/documentation/sitefinity-cms/assets/2ae42529ee099b52a9115aed604af606/image_639147082654362937.png) (*Advanced settings*).

* In *Label*, you can enter a specific name for this widget.\
  This name will be displayed in:
* In *CSS class*, you can enter individual CSS class for the *Intent box* widget.
* In Display on public site for…, you can select which user role can see the widget content when viewing the public site.

### Labels & Messages

In the *Labels & Messages* section, you can do the following:

* In *Label*, you can create a header for the widget visible above the intent input field.
* In P*laceholder text*, you can enter some text to orientate the user for an initial input.\
  For example, you can enter Ask for products, rates, or services... This text is only a guidance for the user and is not submitted as an intent input.
* In *Suggestions* label, you can put a header for the suggestions.

Save your changes.

## Custom widget samples

The *AI ask box* widget is available out of the box with Sitefinity CMS 15.4.8626 and newer versions.\
For older versions or a custom implementation, you can use these samples in GitHub:

* [ASP.NET Core samples](https://github.com/Sitefinity/sitefinity-aspnetcore-mvc-samples/tree/master/src/progress-agentic-rag-widgets)<https://github.com/Sitefinity/nextjs-samples/tree/main/src/progress-agentic-rag-widgets>
* [Next.js samples](https://github.com/Sitefinity/nextjs-samples/tree/main/src/progress-agentic-rag-widgets)  <https://github.com/Sitefinity/nextjs-samples/tree/main/src/progress-agentic-rag-widgets>
* [MVC samples](https://github.com/Sitefinity/mvc-samples/tree/master/ProgressAgenticRAGWidgets)

If you create a custom template or a custom implementation of the *AI ask box* widget, make sure that the URL of the results page includes the `contentTypes` and `lastModified` query string parameters. Otherwise, the *Knowledge scope* settings are not applied.
