Jericho Pasco
Jericho Pasco

Reputation: 1

I have this error on connecting with my Azure database and doing PGVector Storing using Langchain for my LLM. How do I solve this?

from langchain_core.documents import Document
from langchain_postgres import PGVector
from langchain_postgres.vectorstores import PGVector

# See docker command above to launch a postgres instance with pgvector enabled.
connection = f"postgresql+psycopg://{db_user}:{db_pass}@{db_host}:5432/force-embeddings?ssl_cipher" # Uses psycopg3!
collection_name = "vectors_jap_small"


vector_store = PGVector(
    embeddings=embeddings,
    collection_name=collection_name,
    connection=connection,
    use_jsonb=True,
)

Error Message:
SQLAlchemy connection failed: (psycopg.OperationalError) [Errno 8] nodename nor servname provided, or not known
(Background on this error at: https://sqlalche.me/e/20/e3q8)

Is this error because I made a wrong format? or is this because of the Restrictions of the database. I do not have full access to the database since I am not an Admin

I need to be able to connect to the Azure database, my solution is show above

Upvotes: 0

Views: 78

Answers (1)

John
John

Reputation: 1

connection = f"postgresql+psycopg://{db_user}:{db_pass}@{db_host}:5432/force-embeddings?ssl_cipher"

This line seems to be the problem. You should be using the proper credentials and format. Try to connect using psycopg2

Upvotes: 0

Related Questions