Product Selector

Fusion 5.9
    Fusion 5.9

    LWAI NHS plus RAG pipelineLucidworks AI

    This pipeline uses the following stages:

    • Additional Query Parameters

    • [LWAI] Query Rewrite

    • Additional Query Parameters

    • LWAI Vectorize Query

    • Hybrid Query

    • Solr Query

    • LWAI Prediction

    Add the pipeline

    1. Navigate to Querying > Query Pipelines.

    2. Click Add+.

    3. Enter the Pipeline ID, for example LWAI-NHS-plus-RAG.

    4. Remove the default stages except for Solr Query:

      1. Remove the Text Tagger stage.

      2. Remove the Boost with Signals stage.

      3. Remove the Query Fields stage.

      4. Remove the Facets stage.

      5. Remove the Apply Rules stage.

      6. Remove the Modify Response with Rules stage.

    Additional Query Parameters

    Configure the Additional Query Parameters stage as follows.

    1. Click Add a new pipeline stage > Additional Query Parameters.

    2. Enter names, values, and policies for the Parameters and Values:

      1. orig_q - <request.q> - replace.

      2. rewritten_q - <request.q> - replace.

    3. Save the pipeline.

    [LWAI] Query Rewrite

    LWAI Query Rewrite is set up using the LWAI Prediction stage.

    1. Click Add a new pipeline stage > LWAI Prediction.

    2. Enter a Label, such as [LWAI] Query Rewrite.

    3. In the Condition field, enter request.getFirstFieldValue('q') != ':' && request.hasParam('memory_uuid').

    4. Select the Lucidworks AI integration Account Name as defined by your Fusion Administrator.

    5. Select the Use Case, such as standalone-query-rewriter.

    6. Select the Model to use.

    7. Enter the Input context variable as <request.q>.

    8. Enter the Destination Variable Name & Context Output as standalone.

    9. Enter the following under Use Case Configuration:

      1. Parameter Name: memoryUuid.

      2. Parameter Value: <request.memory_uuid>.

    10. Save the pipeline.

    Additional Query Parameters

    Configure another Additional Query Parameters stage as follows.

    1. Click Add a new pipeline stage > *Additional Query Parameters.

    2. Enter the following under Parameters and Values:

      1. Parameter Name: rewitten_q.

      2. Parameter Value: <ctx.lw_ai_standalone-query-rewriter_t>.

      3. Update Policy: replace.

    3. Save the pipeline.

    LWAI Vectorize Query

    Configure the LWAI Vectorize Query stage as follows.

    1. Click Add a new pipeline stage > LWAI Vectorize Query.

    2. Select the Account Name.

    3. Select the Model to use.

    4. Set the Query Input to <request.rewritten_q>.

    5. Enter the Output Context Variable as vector.

    6. Save the pipeline.

    Hybrid Query

    Configure the Hybrid Query stage as follows.

    1. Click Add a new pipeline stage > Hybrid Query.

    2. Set the Lexical Query Input as <request.rewritten_q>.

    3. Enter a value for the Lexical Query Weight, for example, 0.3.

    4. Set the Number of Lexical Results, such as 1000.

    5. In the Vector Query Field, enter the name of the Solr field for KNN vector search.

    6. Set the Vector Input to <ctx.vector>.

    7. Enter a value for the Vector Query Weight, for example, 0.7.

    8. Check the box for Use KNN Query.

    9. Under Use KNN Query, enter Number of Vector Results, such as 1000.

    10. Save the pipeline.

    Solr Query

    Configure the Solr Query stage as follows.

    1. Select the HTTP Method as POST.

    2. Make sure the Generate Response Signal is checked.

    3. Set the Preferred Replica Type to pull.

    4. Save the pipeline.

    LWAI Prediction

    Configure the LWAI Prediction stage as follows.

    1. Click Add a new pipeline stage > LWAI Prediction.

    2. Set the Account Name to the Lucidworks AI integration name as defined by your Fusion Administrator.

    3. Select the Use Case as rag.

    4. Select the Model to use.

    5. Set the Input context variable to <request.rewritten_q>.

    6. Make sure Include Response Documents? is checked.

    7. Enter values into the Use Case Configuration:

      1. Parameter Name: extractRelevantContent.

      2. Parameter Value: false.

    8. Save the pipeline.

    Order the stages

    1. Make sure the stages are in the following order:

      1. Additional Query Parameters

      2. [LWAI] Query Rewrite

      3. Additional Query Parameters

      4. LWAI Vectorize Query

      5. Hybrid Query

      6. Solr Query

      7. LWAI Prediction

    2. Save the pipeline.