Larry Yin commited on
Commit
784d46d
1 Parent(s): 97cf1ed

Revised pgvector connection

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -10,7 +10,7 @@ from langchain.memory import ConversationTokenBufferMemory
10
  openai.api_key = os.environ['OPENAI_API_KEY']
11
  hf_api_key = os.environ['HF_API_KEY']
12
  host = os.environ['host']
13
- port = str(os.environ['port'])
14
  database_name = os.environ['database_name']
15
  user = os.environ['user']
16
  passwd = os.environ['passwd']
@@ -23,11 +23,11 @@ embedding = OpenAIEmbeddings()
23
 
24
  CONNECTION_STRING = PGVector.connection_string_from_db_params(
25
  driver=os.environ.get("PGVECTOR_DRIVER", "psycopg2"),
26
- host=os.environ.get("PGVECTOR_HOST", host),
27
- port=int(os.environ.get("PGVECTOR_PORT", port)),
28
- database=os.environ.get("PGVECTOR_DATABASE", database_name),
29
- user=os.environ.get("PGVECTOR_USER", user),
30
- password=os.environ.get("PGVECTOR_PASSWORD", passwd),
31
  )
32
 
33
  vectordb = PGVector(embedding_function=embedding,
 
10
  openai.api_key = os.environ['OPENAI_API_KEY']
11
  hf_api_key = os.environ['HF_API_KEY']
12
  host = os.environ['host']
13
+ port = os.environ['port']
14
  database_name = os.environ['database_name']
15
  user = os.environ['user']
16
  passwd = os.environ['passwd']
 
23
 
24
  CONNECTION_STRING = PGVector.connection_string_from_db_params(
25
  driver=os.environ.get("PGVECTOR_DRIVER", "psycopg2"),
26
+ host=host
27
+ port=int(port),
28
+ database=database_name,
29
+ user=user,
30
+ password=passwd,
31
  )
32
 
33
  vectordb = PGVector(embedding_function=embedding,