-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing graph with 0 nodes, 0 edges #109
Comments
The following script is generated by AI Agent to help reproduce the issue: # nano-graphrag/reproduce.py
import os
import asyncio
from nano_graphrag import GraphRAG
from nano_graphrag._utils import wrap_embedding_func_with_attrs
import numpy as np
import openai
os.environ["OPENAI_API_KEY"] = "FAKE"
WORKING_DIR = "./tests/nano_graphrag_cache_TEST"
if not os.path.exists(WORKING_DIR):
os.mkdir(WORKING_DIR)
# Mock embedding function
@wrap_embedding_func_with_attrs(embedding_dim=384, max_token_size=8192)
async def local_embedding(texts: list[str]) -> np.ndarray:
return np.random.rand(len(texts), 384)
# Mock model function with connection error
async def mock_model_with_connection_error(prompt, **kwargs):
raise openai.APIConnectionError(request=None)
async def main():
with open("./tests/mock_data.txt", encoding="utf-8-sig") as f:
FAKE_TEXT = f.read()
rag = GraphRAG(
working_dir=WORKING_DIR,
embedding_func=local_embedding,
best_model_func=mock_model_with_connection_error,
enable_naive_rag=True
)
try:
await rag.ainsert(FAKE_TEXT)
except openai.APIConnectionError as e:
raise AssertionError(e)
if __name__ == "__main__":
asyncio.run(main()) How to run: python3 nano-graphrag/reproduce.py Expected Result:
Thank you for your valuable contribution to this project and we appreciate your feedback! Please respond with an emoji if you find this script helpful. Feel free to comment below if any improvements are needed. Best regards from an AI Agent! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, every time I ran insert() in using_llm_api_as_llm+ollama_embedding.py for a few hours, I received the sentence
INFO:nano-graphrag:Writing graph with 0 nodes, 0 edges
, then received an erroropenai.APIConnectionError: Connection error
. Could you share suggestions for a possible fix? Thank you very much.The text was updated successfully, but these errors were encountered: