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
-
Navigate to Querying > Query Pipelines.
-
Click Add+.
-
Enter the Pipeline ID, for example
LWAI-NHS-plus-RAG
. -
Remove the default stages except for Solr Query:
-
Remove the Text Tagger stage.
-
Remove the Boost with Signals stage.
-
Remove the Query Fields stage.
-
Remove the Facets stage.
-
Remove the Apply Rules stage.
-
Remove the Modify Response with Rules stage.
-
Additional Query Parameters
Configure the Additional Query Parameters stage as follows.
-
Click Add a new pipeline stage > Additional Query Parameters.
-
Enter names, values, and policies for the Parameters and Values:
-
orig_q
-<request.q>
-replace
. -
rewritten_q
-<request.q>
-replace
.
-
-
Save the pipeline.
[LWAI] Query Rewrite
LWAI Query Rewrite is set up using the LWAI Prediction stage.
-
Click Add a new pipeline stage > LWAI Prediction.
-
Enter a Label, such as
[LWAI] Query Rewrite
. -
In the Condition field, enter
request.getFirstFieldValue('q') != ':' && request.hasParam('memory_uuid')
. -
Select the Lucidworks AI integration Account Name as defined by your Fusion Administrator.
-
Select the Use Case, such as
standalone-query-rewriter
. -
Select the Model to use.
-
Enter the Input context variable as
<request.q>
. -
Enter the Destination Variable Name & Context Output as
standalone
. -
Enter the following under Use Case Configuration:
-
Parameter Name:
memoryUuid
. -
Parameter Value:
<request.memory_uuid>
.
-
-
Save the pipeline.
Additional Query Parameters
Configure another Additional Query Parameters stage as follows.
-
Click Add a new pipeline stage > *Additional Query Parameters.
-
Enter the following under Parameters and Values:
-
Parameter Name:
rewitten_q
. -
Parameter Value:
<ctx.lw_ai_standalone-query-rewriter_t>
. -
Update Policy:
replace
.
-
-
Save the pipeline.
LWAI Vectorize Query
Configure the LWAI Vectorize Query stage as follows.
-
Click Add a new pipeline stage > LWAI Vectorize Query.
-
Select the Account Name.
-
Select the Model to use.
-
Set the Query Input to
<request.rewritten_q>
. -
Enter the Output Context Variable as
vector
. -
Save the pipeline.
Hybrid Query
Configure the Hybrid Query stage as follows.
-
Click Add a new pipeline stage > Hybrid Query.
-
Set the Lexical Query Input as
<request.rewritten_q>
. -
Enter a value for the Lexical Query Weight, for example,
0.3
. -
Set the Number of Lexical Results, such as
1000
. -
In the Vector Query Field, enter the name of the Solr field for KNN vector search.
-
Set the Vector Input to
<ctx.vector>
. -
Enter a value for the Vector Query Weight, for example,
0.7
. -
Check the box for Use KNN Query.
-
Under Use KNN Query, enter Number of Vector Results, such as
1000
. -
Save the pipeline.
Solr Query
Configure the Solr Query stage as follows.
-
Select the HTTP Method as POST.
-
Make sure the Generate Response Signal is checked.
-
Set the Preferred Replica Type to pull.
-
Save the pipeline.
LWAI Prediction
Configure the LWAI Prediction stage as follows.
-
Click Add a new pipeline stage > LWAI Prediction.
-
Set the Account Name to the Lucidworks AI integration name as defined by your Fusion Administrator.
-
Select the Use Case as
rag
. -
Select the Model to use.
-
Set the Input context variable to
<request.rewritten_q>
. -
Make sure Include Response Documents? is checked.
-
Enter values into the Use Case Configuration:
-
Parameter Name:
extractRelevantContent
. -
Parameter Value:
false
.
-
-
Save the pipeline.
Order the stages
-
Make sure the stages are in the following order:
-
Additional Query Parameters
-
[LWAI] Query Rewrite
-
Additional Query Parameters
-
LWAI Vectorize Query
-
Hybrid Query
-
Solr Query
-
LWAI Prediction
-
-
Save the pipeline.