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:

  1. IBM® watsonx.data, where you provision the Milvus instance.
  2. watsonx.ai, where you build the data source called collections.
  3. 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

Connecting to the Milvus instance

Use data on your Milvus instance in IBM® watsonx.data to connect your agent to it:

  1. In the Knowledge section, go to Documents.

  2. Select Content repository, and click Connect content repository > Milvus.

  3. From Connect to an existing Milvus instance, provide the connection data.

  4. In GRPC host, enter the endpoint URL of the Milvus host.

  5. 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.

  6. In Choose an authentication type, select Basic authentication or API 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.

  7. 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:

Creating a collection

  • 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.

Note:Your selected model must align with the model that you used to create your index.

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.