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)
这个错误是因为我格式错误吗?或者这是因为数据库的限制。我没有数据库的完全访问权限,因为我不是管理员
我需要能够连接到Azure数据库,我的解决方案如上所示
连接 = f“postgresql+psycopg://{db_user}:{db_pass}@{db_host}:5432/force-embeddings?ssl_cipher”
这条线似乎是问题所在。您应该使用正确的凭据和格式。尝试使用 psycopg2 进行连接