Fix the demo issue of PG to cater with new LightRag changes

This commit is contained in:
Samuel Chan
2025-02-21 20:53:00 +08:00
parent 6ed81ed1c6
commit 25342250d6

View File

@@ -37,20 +37,22 @@ async def main():
llm_model_max_token_size=32768, llm_model_max_token_size=32768,
enable_llm_cache_for_entity_extract=True, enable_llm_cache_for_entity_extract=True,
embedding_func=EmbeddingFunc( embedding_func=EmbeddingFunc(
embedding_dim=768, embedding_dim=1024,
max_token_size=8192, max_token_size=8192,
func=lambda texts: ollama_embedding( 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", kv_storage="PGKVStorage",
doc_status_storage="PGDocStatusStorage", doc_status_storage="PGDocStatusStorage",
graph_storage="PGGraphStorage", graph_storage="PGGraphStorage",
vector_storage="PGVectorStorage", vector_storage="PGVectorStorage",
auto_manage_storages_states=False,
) )
# add embedding_func for graph database, it's deleted in commit 5661d76860436f7bf5aef2e50d9ee4a59660146c # add embedding_func for graph database, it's deleted in commit 5661d76860436f7bf5aef2e50d9ee4a59660146c
rag.chunk_entity_relation_graph.embedding_func = rag.embedding_func 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: with open(f"{ROOT_DIR}/book.txt", "r", encoding="utf-8") as f:
await rag.ainsert(f.read()) await rag.ainsert(f.read())