severian42 / GraphRAG-Local-UI

GraphRAG using Local LLMs - Features robust API and multiple apps for Indexing/Prompt Tuning/Query/Chat/Visualizing/Etc. This is meant to be the ultimate GraphRAG/KG local LLM app.
MIT License
1.66k stars 196 forks source link

launch failed no such file or directory: 'indexing/output' #61

Open rickywu opened 2 months ago

rickywu commented 2 months ago
Watching: '/opt/GraphRAG-Local-UI' '/opt/GraphRAG-Local-UI'

2024-07-26 09:05:15,007 - ERROR - Error initializing data: [Errno 2] No such file or directory: 'indexing/output'
Traceback (most recent call last):
  File "/opt/GraphRAG-Local-UI/index_app.py", line 1038, in <module>
    demo = create_interface()
           ^^^^^^^^^^^^^^^^^^
  File "/opt/GraphRAG-Local-UI/index_app.py", line 742, in create_interface
    llm_api_base = normalize_api_base(settings['api_base'])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/GraphRAG-Local-UI/index_app.py", line 373, in normalize_api_base
    api_base = api_base.rstrip('/')
               ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'rstrip'
2024-07-26 09:05:15,196 - INFO - HTTP Request: GET https://api.gradio.app/gradio-messaging/en "HTTP/1.1 200 OK"
hedaoming commented 2 months ago

Just like me, is it because the .env file is not configured? However, the installation description does not indicate that configuration is required.

hedaoming commented 2 months ago

I solved the problem using the following approach.

  1. Create a folder in the project root directory: mkdir indexing
  2. In the indexing folder, create a new .env file. You can refer to env-example.txt for configuration data.
  3. Then, you can successfully start the application by calling: gradio index_app.py
severian42 commented 2 months ago

Hey! So sorry for the confusion. The way GraphRAG is built is to allow you to quickly create and initialize your own indexing directory. This is why the ROOT_DIR and INPUT_DIR are variables you can alter to point to whichever folder directory you need. Here are the basic instructions grafted from the GraphRAG docs that explains the logic:

Create the required input directory: This is where the input for .txt files for Indexing data and the output results will be stored. Also includes the Prompts for Prompt Tuning. - ./indexing

mkdir -p ./indexing/input Copy sample data folder input/ to ./indexing. You can add your own data here in .txt format.

cp input/* ./indexing/input Initialize the ./indexing folder to create the required files:

python -m graphrag.index --init --root ./indexing Move the settings.yaml file, this is the main predefined config file configured with local models :

mv settings.yaml ./indexing

Here are the docs with the straight-forward version and a bit more info: https://microsoft.github.io/graphrag/posts/get_started/

rickywu commented 2 months ago

Hi, I follow the steps:

  1. init graphrag indexing
  2. config .env setting.yaml
  3. run python -m graphrag.index --root ./indexing

but got

graphrag.config.errors.ApiKeyMissingError: API Key is required for Completion API. Please set
either the OPENAI_API_KEY, GRAPHRAG_API_KEY or GRAPHRAG_LLM_API_KEY environment variable.
⠋ GraphRAG Indexer

I'm sure it's in .env and also run export this var

Do I need run indexing before or just run gradio graph_app.py?