Milvus is a vector database that is designed for scalable similarity search.
You can associate a Milvus vector store with a foundation model prompt to use information from documents in the store to ground the prompt input in current facts.
Before you can associate a Milvus vector store with a foundation model prompt, you must perform the one-time task of setting up a connection to the Milvus vector store.
Prerequisite step
Create a Milvus database with the documents that you want to make available as grounding data.
To set up a Milvus database, add Milvus as a service in watsonx.data by completing the following steps:
-
Provision a service instance of watsonx.data in the same region where your watsonx.ai project is hosted.
For more information, see Choosing a watsonx.data plan and provisioning an instance.
This process might take about 10 minutes.
-
From the watsonx.data web console, add the Milvus service to your watsonx.data instance.
For more information, see Adding Milvus service.
Creating an automatic connection to the data store
To set up the store, complete the following steps:
-
From the overview page of your watsonx.ai project, click the Assets tab, and then choose New asset > Ground gen AI with vectorized documents.
-
Choose watsonx.data Milvus.
-
In the Vector database details section, choose Automatically connect to Milvus on watsonx.data.
Note:The option to automatically connect is only available if a watsonx.data instance is provisioned in your account.
-
Choose the instance that you want to use.
-
If you don't have an API key: A message is displayed that asks you to create an API key to use to authenticate the connection to the data store. Click Create.
A new web page opens where you can create a user API key. Create the key, and then return to the data connection setup page and click Reload to use the API key that you created to authenticate the connection.
-
Click Create connection.
-
Optional: Review the connection details that were added automatically.
-
Click Create, and then click Create.
A data store connection is now established. When you create a vector index asset for grounding documents, you can choose the Select or create vector index option, and then select the Milvus data store instance that you just configured.
Getting Milvus data store details manually
Collect the details about the data source connection.
-
From the Milvus service in the watsonx.data console, make a note of the gRPC host value.
gRPC is a Remote Procedure Call (RPC) framework that enables distributed services to communicate.
For example, the gRPC host value might be
5c3c2a83-b4gg-4d96-8da4-5a2f1739a496.example.appdomain.cloud:30439
-
From the IBM Cloud console, create a personal API key and store it securely.
For more information, see Managing user API keys.
-
From the overview page of your watsonx.ai project, click the Assets tab, and then choose New asset > Ground gen AI with vectorized documents.
-
In the Vector database details section, choose Select or create a connection, and then choose Create connection.
-
Add a name for the connection.
-
For the connection details, convert the gRPC host value that you noted earlier into separate
host
andport
properties.For example, if the gRPC host value is
5c3c2a83-b4gg-4d96-8da4-5a2f1739a496.example.appdomain.cloud:30439
, specify the properties as follows:host
: Segment of the value before the colon. For example,5c3c2a83-b4gg-4d96-8da4-5a2f1739a496.example.appdomain.cloud
.port
: Segment of the value after the colon. For example,30439
.
-
Define the credentials for the connection.
-
When you specify the username, use the following format:
ibmlhapikey_<your-email-id>
-
Use the personal API key that you created earlier as the password for the connection.
-
-
Verify that the Port is SSL-enabled option is selected.
-
If you include a certificate, you must specify a certificate that is signed by a known certificate authority. A self-signed SSL certificate is not sufficient.
-
Click Create.
Learn more
Parent topic: Creating a vector index