Update rag_chain.py
This commit is contained in:
parent
7513149bdb
commit
f81a3bd52f
@ -3,7 +3,7 @@ import os
|
||||
import weaviate
|
||||
from weaviate import Client
|
||||
from weaviate import WeaviateClient
|
||||
from weaviate.connect import ConnectionParams
|
||||
from weaviate.connect import ConnectionParams, AuthCredentials
|
||||
from weaviate.auth import AuthApiKey
|
||||
from weaviate.classes.init import Auth
|
||||
from langchain.vectorstores import Weaviate
|
||||
@ -107,33 +107,33 @@ def build_rag_chain():
|
||||
else:
|
||||
print("연결 실패 3. 서버 상태를 확인하세요.")
|
||||
|
||||
client4 = weaviate.Client(
|
||||
url="http://183.111.96.67:32668",
|
||||
auth_client_secret=auth
|
||||
|
||||
auth_key = AuthCredentials.api_key("01js3q6y7twaxccm5dbh3se9bt") # 없으면 None
|
||||
|
||||
# 커넥션 설정 (http, grpc 둘 다)
|
||||
connection_params = ConnectionParams.from_params(
|
||||
http_host="183.111.96.67",
|
||||
http_port=32668,
|
||||
http_secure=False,
|
||||
grpc_host="183.111.96.67",
|
||||
grpc_port=32619, # 예시 포트, 실제 grpc 포트 넣어야 함
|
||||
grpc_secure=False,
|
||||
auth_credentials=auth_key # 없으면 생략 가능
|
||||
)
|
||||
|
||||
client4 = WeaviateClient(connection_params=connection_params)
|
||||
|
||||
if client4.is_ready():
|
||||
print("Weaviate 4 연결 성공!")
|
||||
else:
|
||||
print("연결 실패 4. 서버 상태를 확인하세요.")
|
||||
|
||||
|
||||
|
||||
|
||||
client5 = weaviate.Client(
|
||||
url="s4x71b3lt32z3md1ya0yw.c0.asia-southeast1.gcp.weaviate.cloud",
|
||||
auth_client_secret=AuthApiKey("0ojxypfXy2Y1rKw3KQdBUtwcWSrYPWitE7Qu")
|
||||
)
|
||||
|
||||
if client5.is_ready():
|
||||
print("Weaviate 5 연결 성공!")
|
||||
else:
|
||||
print("연결 실패 5. 서버 상태를 확인하세요.")
|
||||
legacy_client = weaviate.Client(connection_params=client4.connection_params) # langchain용
|
||||
|
||||
|
||||
# 2. 벡터스토어
|
||||
vectorstore = Weaviate(
|
||||
client=client4,
|
||||
client=legacy_client,
|
||||
index_name="LangDocs",
|
||||
text_key="text",
|
||||
embedding=OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user