Skip to content

Commit d333986

Browse files
committed
ChainServer: fix bug to connect external pgvector
1 parent 3d29acf commit d333986

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-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+
connection_string = f"postgresql://{os.getenv('POSTGRES_USER', '')}:{os.getenv('POSTGRES_PASSWORD', '')}@{config.vector_store.url}/{os.getenv('POSTGRES_DB', '')}"
130+
db_name = os.getenv('POSTGRES_DB', '')
131131

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

deploy/compose/compose.env

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export MODEL_DIRECTORY="/home/nvidia/llama2_13b_chat_hf_v1/"
66
# Fill this out if you dont have a GPU. Leave this empty if you have a local GPU
77
export NVIDIA_API_KEY="nvapi-*"
88

9+
export AI_PLAYGROUND_API_KEY="nvapi-*"
10+
911
# flag to enable activation aware quantization for the LLM
1012
# export QUANTIZATION="int4_awq"
1113

@@ -34,11 +36,15 @@ export RAG_EXAMPLE="developer_rag"
3436
# [OPTIONAL] the config file for chain server w.r.t. pwd
3537
export APP_CONFIG_FILE=/dev/null
3638

37-
# parameters for PGVector, update this when using PGVector Vecotor store
39+
# parameters for PGVector, update this when using PGVector Vector store
3840
# export POSTGRES_PASSWORD=password
3941
# export POSTGRES_USER=postgres
4042
# export POSTGRES_DB=api
4143

44+
# Update this line when using an external PGVector Vector store
45+
# export POSTGRES_HOST_IP=pgvector
46+
# export POSTGRES_PORT_NUMBER=5432
47+
4248
### Riva Parameters:
4349

4450
# 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)