Skip to main content
With the ADK, you can create a knowledge bases for your agents, either by connecting to your own ElasticSearch or Milvus instance, or by uploading your documents. Use YAML, JSON or Python files to create your knowledge bases for watsonx Orchestrate.

Creating built-in Milvus knowledge bases

If you don’t have an existing Milvus or Elasticsearch instance to connect to, you can create a knowledge base by simply uploading your documents. These documents will be ingested into the built-in Milvus instance, which will serve as the backend for your knowledge base. The supported documents must follow these requirements:
  • Each file must have a unique name.
  • A single batch can include up to 20 files, with a total size limit of 30 MB.
  • The maximum file size for .docx, .pdf, .pptx, and .xlsx files is 25 MB.
  • The maximum file size for .csv, .html, and .txt files is 5 MB.
The embedding model can be either a model hosted on watsonx.ai or a custom model of type embedding.
Note: The embeddings_model_name field is optional. If you don’t provide it, the system uses ibm/slate-125m-english-rtrvr-v2 by default.
Example using an OpenAI embedding model:
Example using a watsonx.ai embedding model:
Once the knowledge base is created, you can check its status to see when it’s ready for use.

Creating external knowledge bases

External knowledge bases allow you to connect your existing Milvus or Elasticsearch databases as a knowledge source for your agent. To configure a knowledge base with your external database, use the conversational_search_tool.index_config to define the connection details for your Milvus or Elasticsearch instance. Use the field_mapping in your index_config to to specify which fields from the search results are used for the title, body and optionally url of the search result

Milvus

When connecting to a Milvus instance: Ensure the provided embedding_model_id is the one used when ingesting the documents in your index. Additionally, ensure you use the GRPC host and port from your Milvus instance Connections will fail if you use the HTTP host or port. Optionally, provide the server_cert to use a custom server certificate when connecting to a Milvus instance.

ElasticSearch

For Elasticsearch, you can provide a custom query_body that will be sent as the POST body in the search request. This allows for advanced query customization.
  • If provided, the query_body must include the $QUERY token, which will be replaced by the user’s query at runtime.
  • If no custom query_body is provided, a keyword search will be used.
To further customize the ElasticSearch query, result_filter can be set to an array of ElasticSearch filters. If using both query_body and result_filter, the query_body must include the $FILTER token, which will be replaced by the result_filter array at runtime.
For more information about ElasticSearch query body and filters customizations, see How to configure the advanced Elasticsearch settings
With custom search, you can connect your own search server, enabling out-of-the-box alternatives to the default search solutions. To set up a custom search, configure the URL and optionally the filter and metadata for your search. For example:
Some custom search configurations require authentication. In that case, create a connection and pass it along with the knowledge base when you import it. To set up the server for your custom service, see Connecting to a content repository on a custom service.

AstraDB

To connect to AstraDB knowledge base, in your knowledge base file, configure the api_endpoint, data_type, and embedding_mode for your AstraDB. You can also configure optional fields like port, server_cert, keyspace, collection, table, index_column, embedding_model_id, search_mode, limit, filter, and field_mapping.

Configuring generation options

With the ADK, you can further fine-tune how your agent uses knowledge through the conversational_search_tool configuration in your knowledge base. You can apply these settings to both built-in Milvus knowledge bases and external knowledge bases. Below are the configurable options available within the conversational_search_tool section:
Note: In dynamic knowledge bases, only the max_docs_passed_to_llm and citations_shown parameters apply. All other settings are ignored.

Configuring dynamic knowledge bases (Public preview)

This feature is currently in public preview. Functionality and behavior may change in future updates.
By default, classic knowledge base is used as a linear pipeline that retrieves information from whatever content store it is connected to. It takes the user’s input and the conversation context to create a query against that store and then generates an answer which is sent back to the agent. Enabling dynamic mode allows knowledge base to retrieve information as before, but the agent decides how to use it. The agent may generate an answer or use the retrieved information as context to complete tasks. In addition, the agent can be configured to create a query against the content store. To configure a dynamic knowledge base, update your configuration file with the following parameters in the conversational_search_tool schema: Example: