Configuring an Alternative Vector Database
Supported Vector Databases
By default, the Docker Compose files for the examples deploy Milvus as the vector database. Alternatively, you can deploy pgvector.
Configuring pgvector as the Vector Database
Edit the Docker Compose file for the example, such as
deploy/compose/rag-app-text-chatbot.yaml
.Update the environment variables within the chain server service:
services: chain-server: container_name: chain-server environment: APP_VECTORSTORE_NAME: "pgvector" APP_VECTORSTORE_URL: "pgvector:5432" POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password} POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_DB: ${POSTGRES_DB:-api}
The preceding example shows the default values for the database user, password, and database. To override the defaults, edit the values in the Docker Compose file, or set the values in the
compose.env
file.Optional: If a container for a vector database is running, stop the container:
$ docker compose -f deploy/compose/docker-compose-vectordb.yaml down
Stop and then start the services:
$ docker compose --env-file deploy/compose/compose.env -f deploy/compose/<rag-example>.yaml down $ docker compose --env-file deploy/compose/compose.env -f deploy/compose/<rag-example>.yaml up -d --remove-orphans
Start the pgvector container:
$ docker compose -f deploy/compose/docker-compose-vectordb.yaml up -d pgvector
Optional: View the chain server logs to confirm the vector database.
View the logs:
$ docker logs -f chain-server
Upload a document to the knowledge base. Refer to Use Unstructured Documents as a Knowledge Base for more information.
Confirm the log output includes the vector database:
INFO:example:Ingesting <file-name>.pdf in vectorDB INFO:RetrievalAugmentedGeneration.common.utils:Using pgvector as vector store INFO:RetrievalAugmentedGeneration.common.utils:Using PGVector collection: <example-name>
Configuring Milvus as the Vector Database
Edit the Docker Compose file for the example, such as
deploy/compose/rag-app-text-chatbot.yaml
.Update the environment variables within the chain server service:
services: chain-server: container_name: chain-server environment: APP_VECTORSTORE_NAME: "milvus" APP_VECTORSTORE_URL: "http://milvus:19530"
Optional: If a container for a vector database is running, stop the container:
$ docker compose -f deploy/compose/docker-compose-vectordb.yaml down
Stop and then start the services:
$ docker compose --env-file deploy/compose/compose.env -f deploy/compose/<rag-example>.yaml down $ docker compose --env-file deploy/compose/compose.env -f deploy/compose/<rag-example>.yaml up -d --remove-orphans
Start the Milvus container:
$ docker compose -f deploy/compose/docker-compose-vectordb.yaml up -d milvus
Optional: View the chain server logs to confirm the vector database.
View the logs:
$ docker logs -f chain-server
Upload a document to the knowledge base. Refer to Use Unstructured Documents as a Knowledge Base for more information.
Confirm the log output includes the vector database:
INFO:example:Ingesting <file-name>.pdf in vectorDB INFO:RetrievalAugmentedGeneration.common.utils:Using milvus as vector store INFO:RetrievalAugmentedGeneration.common.utils:Using milvus collection: <example-name>