Associate a Relevance Generative Answering (RGA) model with a query pipeline

When a Coveo Machine Learning (Coveo ML) model has been created, it must be associated with a query pipeline to be effective in a search interface.

organization members with the required privileges can access the Machine Learning tab of a query pipeline configuration page to manage Coveo ML model associations for that query pipeline.

When a Relevance Generative Answering (RGA) model is associated with a query pipeline, the model is used to generate answers for queries that are submitted in the search interface that’s associated with the query pipeline.

Notes

Associate an RGA model

  1. On the Query Pipelines (platform-ca | platform-eu | platform-au) page, click the query pipeline for which you want to associate the model, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab, and then in the upper-right corner, click Associate Model.

  3. In the Model dropdown menu, select the desired model.

  4. On the right side, under Condition, you can select a query pipeline condition in the dropdown menu or create a new one.

    Note

    An RGA model must be associated with a Query is not empty condition.

  5. Click Associate Model.

Edit an RGA model association

  1. On the Query Pipelines (platform-ca | platform-eu | platform-au) page, click the query pipeline for which you want to edit a model association, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab, click the desired model, and then click Edit in the Action bar.

  3. On the right side, under Condition, you can select a query pipeline condition in the dropdown menu or create a new one.

    Note

    An RGA model must be associated with a Query is not empty condition.

  4. Click Save.

Dissociate a model

  1. On the Query Pipelines (platform-ca | platform-eu | platform-au) page, click the query pipeline from which you want to dissociate a model, and then click Edit components in the Action bar.

  2. On the subpage that opens, select the Machine Learning tab.

  3. In the Machine Learning tab, click the model you want to dissociate from the pipeline, and then click Dissociate in the Action bar.

RGA model association advanced configuration

You can use the RGA model association advanced configuration to:

Important

Modifying the default values for the model association advanced parameters may result in unintended model behavior following a model version upgrade.

Maximum number of items to consider

RGA uses two stages of content retrieval. First-stage content retrieval identifies the most relevant items in the index, and second-stage content retrieval identifies the most relevant segments of text (chunks) from the items identified during first-stage content retrieval. The answer is generated using the most relevant chunks.

If you find that answers are being generated using text from low relevance documents, you can use the numberOfRankedResultsToConsider model association parameter to set a custom value for the maximum number of items considered during second-stage content retrieval. For example, if you set the maximum number of items to 20, the RGA model retrieves the most relevant chunks only from the 20 most relevant items that were retrieved during first-stage content retrieval.

Important

This is an advanced model association configuration that should be used by experienced Coveo administrators only.

The default setting of 100 provides good results in the majority of use cases. However, you can specify a custom value if you have a finely tuned query pipeline and you have a good understanding of the relevance hierarchy of the search results that are returned by your query pipeline configuration. Otherwise, if you set the value too low, there may not be enough relevant text (chunks) to generate an answer.

To set a custom value for the number of items to consider for RGA

  1. On the Query Pipelines (platform-ca | platform-eu | platform-au) page, click the query pipeline to which the RGA model is associated, and then click Edit components in the Action bar.

  2. Select the Machine Learning tab, click the RGA model, and then click Edit in the Action bar.

  3. On the Edit a Model Association subpage, in the upper-right corner, click dots, and then click Switch to JSON view.

  4. In the confirmation window that appears, click Switch to JSON view.

  5. In the JSON editor, add the following "numberOfRankedResultsToConsider": "<VALUE>" under customQueryParameters, where <VALUE> is the maximum number of items.

    The value must be an integer between 1 and 100 (default is 100).

    Example

    To set the custom value to 20, the JSON would be as follows:

    {
      "customQueryParameters":{
        "numberOfRankedResultsToConsider": 20
      }
    }

RGA semantic similarity threshold

During second-stage content retrieval, RGA retrieves the most relevant segments of text (chunks) based on semantic similarity with the query. The answer is then generated using the most relevant chunks. A preset similarity threshold, however, determines whether or not a chunk is considered relevant by the RGA model.

Depending on your indexed content, the default semantic similarity threshold may result in one of the following scenarios:

  • An answer isn’t generated due to a lack of relevant chunks (threshold value is too high).

  • An answer is generated, but some of the chunks used to generate the answer are of lower relevance (threshold value is too low).

If you find that answers aren’t being generated, or answers are generated with less relevant chunks, you can use the chunksSimilarityThreshold model association parameter to set a custom value for the semantic similarity threshold.

Important

This is an advanced model association configuration that should be used by experienced Coveo administrators only.

The default setting of 0.5, which is the midpoint of the allowable range, provides good results in the majority of use cases. However, you can specify a custom value if you have a good understanding of your indexed content and want to fine-tune the semantic similarity threshold that’s used by the RGA model to retrieve relevant chunks. If you set the value too high, there may not be enough relevant text (chunks) to generate an answer, but if you set the value too low, answers may be generated with less relevant chunks.

To set a custom value for the RGA semantic similarity threshold

  1. On the Query Pipelines (platform-ca | platform-eu | platform-au) page, click the query pipeline to which the RGA model is associated, and then click Edit components in the Action bar.

  2. Select the Machine Learning tab, click the RGA model, and then click Edit in the Action bar.

  3. On the Edit a Model Association subpage, in the upper-right corner, click dots, and then click Switch to JSON view.

  4. In the confirmation window that appears, click Switch to JSON view.

  5. In the JSON editor, add "chunksSimilarityThreshold": "<VALUE>" under customQueryParameters, where <VALUE> is the threshold value.

    The value must be a floating-point number between 0 and 1.0 (default is 0.5).

    A higher threshold value means that a chunk needs to be highly similar to the query to be considered relevant. A lower threshold value means that a chunks only needs to be slightly similar to the query to be considered relevant.

    Example

    Answers aren’t being generated with expected regularity, so you decide to lower the semantic similarity threshold to 0.45. In this case, the JSON would be as follows:

    {
      "customQueryParameters":{
        "chunksSimilarityThreshold": 0.45
      }
    }

Rich text formatting

By default, the answers generated by RGA are displayed in the RGA search interface component using plain text. This means that the generated answers don’t include any rich text formatting, such as bold text, code blocks, or tables.

Rich text formatting makes the generated answers more visually appealing and easier to read. To enable rich text formatting for generated answers, you must enable the enableContentFormat model association parameter.

RGA supports the following rich text formatting:

  • Headings

  • Strong and emphasized text (bold/italic)

  • Inline and multi-line code blocks

  • Quote blocks

  • Ordered and unordered lists

  • Tables

Examples

The following are examples of a generated answer with rich text formatting:

Relevance Generative Answering rephrase
Relevance Generative Answering rephrase

To enable rich text formatting for generated answers

Important

If you’re using the Coveo Headless library for your search interface, besides enabling rich text formatting as detailed in this section, you must also set text/markdown as the first value in the contentFormat property array for GeneratedResponseFormat. The answer is generated using the first format in the contentFormat property array, from left to right, that’s supported by the RGA component. Coveo recommends that you include text/plain as the last value in the array as a fallback. For example, contentFormat: ['text/markdown', 'text/plain'].

  1. On the Query Pipelines (platform-ca | platform-eu | platform-au) page, click the query pipeline to which the RGA model is associated, and then click Edit components in the Action bar.

  2. Select the Machine Learning tab, click the RGA model, and then click Edit in the Action bar.

  3. On the Edit a Model Association subpage, in the upper-right corner, click dots, and then click Switch to JSON view.

  4. In the confirmation window that appears, click Switch to JSON view.

  5. In the JSON editor, add "enableContentFormat": true under customQueryParameters to enable rich text formatting.

    Example

    To enable rich text formatting, the JSON would be as follows:

    {
      "customQueryParameters":{
        "enableContentFormat": true
      }
    }

Reference

Required privileges

By default, members with the required privileges can view and edit elements of the Models (platform-ca | platform-eu | platform-au) page.

The following table indicates the privileges required to use elements of the Models page and associated panels (see Manage privileges and Privilege reference).

Action Service - Domain Required access level

View model associations

Machine Learning - Models
Organization - Organization
Search - Query pipelines

View

Edit model associations

Organization - Organization
Machine Learning - Models

View

Search - Query pipelines

Edit