From 25342250d64295a4dc9ec0d7a861cc1da63c3196 Mon Sep 17 00:00:00 2001 From: Samuel Chan Date: Fri, 21 Feb 2025 20:53:00 +0800 Subject: [PATCH] Fix the demo issue of PG to cater with new LightRag changes --- examples/lightrag_zhipu_postgres_demo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/lightrag_zhipu_postgres_demo.py b/examples/lightrag_zhipu_postgres_demo.py index 913361b3..8f40690e 100644 --- a/examples/lightrag_zhipu_postgres_demo.py +++ b/examples/lightrag_zhipu_postgres_demo.py @@ -37,20 +37,22 @@ async def main(): llm_model_max_token_size=32768, enable_llm_cache_for_entity_extract=True, embedding_func=EmbeddingFunc( - embedding_dim=768, + embedding_dim=1024, max_token_size=8192, func=lambda texts: ollama_embedding( - texts, embed_model="nomic-embed-text", host="http://localhost:11434" + texts, embed_model="bge-m3", host="http://localhost:11434" ), ), kv_storage="PGKVStorage", doc_status_storage="PGDocStatusStorage", graph_storage="PGGraphStorage", vector_storage="PGVectorStorage", + auto_manage_storages_states=False, ) # add embedding_func for graph database, it's deleted in commit 5661d76860436f7bf5aef2e50d9ee4a59660146c rag.chunk_entity_relation_graph.embedding_func = rag.embedding_func + await rag.initialize_storages() with open(f"{ROOT_DIR}/book.txt", "r", encoding="utf-8") as f: await rag.ainsert(f.read())