Skip to content

Commit

Permalink
Update strolr_amia.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-n committed Nov 6, 2024
1 parent cf30121 commit fd10f28
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions strolr_amia.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,21 @@

## DATABASE

COLLECTION_NAME = "strolr_test"
CONNECTION_STRING = PGVector.connection_string_from_db_params(
driver=os.environ.get("PGVECTOR_DRIVER", "psycopg2"),
host=os.environ.get("PGVECTOR_HOST", "vectordb.cfowaqqqovp0.us-east-2.rds.amazonaws.com"),
port=int(os.environ.get("PGVECTOR_PORT", "5432")),
database=os.environ.get("PGVECTOR_DATABASE", "postgres"),
user=os.environ.get("PGVECTOR_USER", "postgres"),
password=os.environ.get("PGVECTOR_PASSWORD", "temporary"),
)

conn = psycopg2.connect(
host="vectordb.cfowaqqqovp0.us-east-2.rds.amazonaws.com",
database="postgres",
user="postgres",
password="temporary")
#COLLECTION_NAME = "strolr_test"
#CONNECTION_STRING = PGVector.connection_string_from_db_params(
# driver=os.environ.get("PGVECTOR_DRIVER", "psycopg2"),
# host=os.environ.get("PGVECTOR_HOST", "vectordb.cfowaqqqovp0.us-east-2.rds.amazonaws.com"),
# port=int(os.environ.get("PGVECTOR_PORT", "5432")),
# database=os.environ.get("PGVECTOR_DATABASE", "postgres"),
# user=os.environ.get("PGVECTOR_USER", "postgres"),
# password=os.environ.get("PGVECTOR_PASSWORD", "temporary"),
#)

#conn = psycopg2.connect(
# host="vectordb.cfowaqqqovp0.us-east-2.rds.amazonaws.com",
# database="postgres",
# user="postgres",
# password="temporary")


# Create a string for downloadable chat history
Expand Down Expand Up @@ -136,12 +136,17 @@ def format_response(responses):
def load_chain_with_sources():

embeddings = OpenAIEmbeddings()
# store = PGVector(
# collection_name=COLLECTION_NAME,
# connection_string=CONNECTION_STRING,
# embedding_function=embeddings,
# )
connection = "postgresql+psycopg://langchain:[email protected]:5432/strolrdb"
collection_name = "strolr_docs"
store = PGVector(
collection_name=COLLECTION_NAME,
connection_string=CONNECTION_STRING,
embedding_function=embeddings,
)

embeddings=embeddings,
collection_name=collection_name,
connection=connection)
retriever = store.as_retriever(search_type="similarity_score_threshold", search_kwargs = {"k":3, "score_threshold":0.8})
llm = ChatOpenAI(temperature = 0.8, model = "gpt-4o-mini")

Expand Down

0 comments on commit fd10f28

Please sign in to comment.