main
HuangHai 2 weeks ago
parent 39e9ad7925
commit 4704d694bc

@ -6,5 +6,6 @@ docker tag swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/shangor/postgres-
- 启动
```
docker rm if -f postgres-LightRag
docker run -p 5432:5432 -d --name postgres-LightRag shangor/postgres-for-rag sh -c "service postgresql start && sleep infinity"
```

@ -21,7 +21,7 @@ logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)
async def main():
try:
rag = await initialize_pg_rag(WORKING_DIR)
rag = await initialize_pg_rag(WORKING_DIR=WORKING_DIR,namespace_prefix='huanghai')
with open(f"../Txt/sushi.txt", "r", encoding="utf-8") as f:
await rag.ainsert(f.read())
finally:

@ -142,6 +142,7 @@ def create_embedding_func():
),
)
# AGE
os.environ["AGE_GRAPH_NAME"] = AGE_GRAPH_NAME
os.environ["POSTGRES_HOST"] = POSTGRES_HOST
@ -150,7 +151,8 @@ os.environ["POSTGRES_USER"] = POSTGRES_USER
os.environ["POSTGRES_PASSWORD"] = POSTGRES_PASSWORD
os.environ["POSTGRES_DATABASE"] = POSTGRES_DATABASE
async def initialize_pg_rag(WORKING_DIR):
async def initialize_pg_rag(WORKING_DIR, namespace_prefix):
rag = LightRAG(
working_dir=WORKING_DIR,
llm_model_func=llm_model_func,
@ -168,9 +170,10 @@ async def initialize_pg_rag(WORKING_DIR):
graph_storage="PGGraphStorage",
vector_storage="PGVectorStorage",
auto_manage_storages_states=False,
namespace_prefix=namespace_prefix,
)
await rag.initialize_storages()
await initialize_pipeline_status()
return rag
return rag

Loading…
Cancel
Save