Connecting to a content repository on Milvus
Connect your agent to a content repository on a Milvus instance.
To connect to a content repository on Milvus, you must use the following products or tools:
- IBM® watsonx.data, where you provision the Milvus instance.
- watsonx.ai, where you build the data source called collections.
- Agent builder, where you build agents and set up the connection with a Milvus instance.
Comply with the prerequisites for connecting Milvus before you start the procedure to connect your agent to a content repository on a Milvus instance.
Prerequisites for connecting Milvus
-
You must have an active account on IBM® watsonx.data and watsonx.ai.
To create an account on IBM® watsonx.data see, IBM® watsonx.data home page.
To create an account on watsonx.ai, see watsonx.ai home page.
-
You must provision a Milvus instance in IBM® watsonx.data.
For more information on creating a Milvus instance in IBM® watsonx.data, see Adding Milvus service in IBM® watsonx.data.
For more information on creating an API key, see API keys.
-
You must configure IBM® watsonx.data Milvus in IBM watsonx.ai.
To configure IBM® watsonx.data in IBM watsonx.ai, see Configuring IBM® watsonx.data in IBM watsonx.ai.
For more details on creating a vector index, see Creating vector index.
For more information about creating collections, see Creating collections.
Connecting to the Milvus instance
Use data on your Milvus instance in IBM® watsonx.data to connect your agent to it:
-
In the Knowledge section, go to Documents.
-
Select Content repository, and click Connect content repository > Milvus.
-
From Connect to an existing Milvus instance, provide the connection data.
-
In GRPC host, enter the endpoint URL of the Milvus host.
-
In GRPC port, enter the port to connect to the Milvus host.
To get the details of GRPC host and GRPC port, see Connection details.
-
In Choose an authentication type, select
Basic authentication
orAPI key
.- If you select
Basic authentication
, you must provide a username and password. - If you select
watsonx.data API key
, you must provide the corresponding API key. - If you select
None
, you don;t need to provide any other authentication details.
For more information about credentials, see Getting credentials.
- If you select
-
Click Next.
Ingesting data into the Milvus vector database through watsonx.ai
After you collect information from IBM® watsonx.data, you must ingest data into the Milvus database to use in your agent.
In the Milvus window, click Next to go to Select data source and provide the following details:
- In Database, enter the name of the database.
- In Choose collection, select your collection. For more information, see Prerequisites for Milvus integration.
- In Choose index, select the index.
- In Choose embedding_model_id, select your model.
For more information on the supported embedding models, see Embedding models.
Configuring the result content
After you connect Milvus by selecting the data source, you can configure how the search response displays in the Milvus window of your assistant. In the Configure result content section of Configure settings, provide the following fields to map the title, body, and URL from Milvus to the search response:
-
Title
Search result title. Use the title, name, or similar type of field from the collection as the search result title.
-
Body
Search result description. Use an abstract, summary, or highlight field from the collection as the search result body.
-
URL
This field can be populated with any footer content that you want to include at the end of the search result.
Defining filter expressions
In the Advanced Milvus settings section, you can configure the custom filter to query results from Milvus. This following example shows how you can define a filter expression:
-
Contains: Returns only the search results with title that contains the word
action
. Example:title like "%action%"
-
Doesn't contain: Returns only the search results with title not containing the word
action
. Example:not (title like "%action%")
-
Nested filter expression: Returns only the search results with the title that contains the word "action" and the url being one of ["www.url1.com", "www.url2.com"]. Example:
(title like "%action%") and (url in ["www.url1.com", "www.url2.com"])
What to do next
After you connect to Milvus, you can modify the repository connection data or the settings you provided to fetch the documents.
Also, if you want to fine tune how your agent uses the search results, see Editing the settings of the search results.