Skip to content

Commit 77d2599

Browse files
authored
Merge pull request NVIDIA#40 from harperjuanl/rag-0.3-pgvector-dsm
ChainServer: fix bug to connect external pgvector
2 parents c81cdc6 + 0a98783 commit 77d2599

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

RetrievalAugmentedGeneration/common/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ def get_vector_index() -> VectorStoreIndex:
126126

127127
logger.info(f"Using {config.vector_store.name} as vector store")
128128
if config.vector_store.name == "pgvector":
129-
connection_string = f"postgresql://{os.getenv('POSTGRES_USER', '')}:{os.getenv('POSTGRES_PASSWORD', '')}@{config.vector_store.url}"
130-
db_name = "vector_db"
129+
db_name = os.getenv('POSTGRES_DB', 'vector_db')
130+
connection_string = f"postgresql://{os.getenv('POSTGRES_USER', '')}:{os.getenv('POSTGRES_PASSWORD', '')}@{config.vector_store.url}/{db_name}"
131131

132132
conn = psycopg2.connect(connection_string)
133133
conn.autocommit = True

deploy/compose/compose.env

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ export RAG_EXAMPLE="developer_rag"
3434
# [OPTIONAL] the config file for chain server w.r.t. pwd
3535
export APP_CONFIG_FILE=/dev/null
3636

37-
# parameters for PGVector, update this when using PGVector Vecotor store
37+
# parameters for PGVector, update this when using PGVector Vector store
3838
# export POSTGRES_PASSWORD=password
3939
# export POSTGRES_USER=postgres
4040
# export POSTGRES_DB=api
4141

42+
# Update this line when using an external PGVector Vector store
43+
# export POSTGRES_HOST_IP=pgvector
44+
# export POSTGRES_PORT_NUMBER=5432
45+
4246
### Riva Parameters:
4347

4448
# Riva Speech API URI: Riva Server IP address/hostname and port

deploy/compose/docker-compose-pgvector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ services:
5656
EXAMPLE_NAME: ${RAG_EXAMPLE}
5757
command: --port 8081 --host 0.0.0.0
5858
environment:
59-
APP_VECTORSTORE_URL: "pgvector:5432"
59+
APP_VECTORSTORE_URL: "${POSTGRES_HOST_IP:-pgvector}:${POSTGRES_PORT_NUMBER:-5432}"
6060
APP_VECTORSTORE_NAME: "pgvector"
6161
APP_LLM_SERVERURL: "llm:8001"
6262
APP_LLM_MODELNAME: "ensemble"

0 commit comments

Comments
 (0)