Creating a RAG pipeline
Automatically generate code to set up and use an OCI Generative AI connector with OCI Search with OpenSearch for an end-to-end a Retrieval-Augmented Generation (RAG) pipeline.
Before you start, review and implement the prerequisites for using an OCI Generative AI connector with OCI Search with OpenSearch.
Open the navigation menu and click Databases. Under OpenSearch, click Clusters.
Under List scope, select the compartment that contains the cluster.
In the Clusters list, click the name of the cluster that you want to create the RAG pipeline for.
On the cluster details page, click Create RAG pipeline.
On the Configure RAG pipeline page, in General Information, enter a name, description, and tag for the pipeline, and then specify one or more context fields. Context fields specify the text that gets translated into embeddings for the index. Values specified here must match fields that exist in the index.
To use the functionality to automatically generate the code for the Generative AI connector from the Console, the cluster's password must be stored using a secret with the OCI Vault service. If the password is already stored as a Vault secret, specify the username in Cluster Vault credentials, and then select the vault, vault secret, and secret version for the cluster.
If the password isn't stored as a Vault secret, click create a vault and secret, and then do the following:
- Create a vault.
- After the vault is active, create a key for the vault.
- For the vault, create a secret with the following
specifics:
- Select the key that you created in the previous step.
- Manually enter the password for the OpenSearch cluster with the
following format:
- Secret Type Template:
Plain-Text
- Secret Contents:
<OpenSearch-password>
- Secret Type Template:
In Model group, enter a name and description for the model group. If you enter the name of an existing model group, the generated code uses the model group ID for the existing model group, otherwise a new model group is created.
-
Click Next.
On the Configure Generative AI connector page, in Generative AI connector, enter a name and description for the connector.
Select the action, and then select the model to use for the connector.
-
The fields in Gen AI model parameters section are populated with default values, based on the model you selected in the previous step. You can change the parameter values. You can only enter valid parameters, and allowed parameter values are based on the model you select. A parameter value that works for one model might not work if you select a different model.
-
In Gen AI register model, enter a name and description for the Generative AI model.
-
Click Next.
-
The Generate code page contains code you use to create the RAG pipeline, based on the options you specified on the previous pages in the in the Create RAG pipeline workflow. For standalone code that you can copy or download, select Java or Python from the Language dropdown. You can then copy or download the code in the first text area into an application. The application needs to be run from a VM instance within the same subnet as the cluster, or you can set up port forwarding to run the code locally. See Task 5: Query the OCI Search Service for examples of these options.
If you select Kibana, the code generated can't be run as a standalone application. Instead, the generated code contains is split into sequential steps that you copy to run from the cluster's OpenSearch Dashboard.
The second text area contains template code showing how to perform queries after the pipeline is created.