Watch More GraphRAG Videos: 🔥GraphRAG with Ollama - Install Local Models for RAG - Easiest Tutorial ruclips.net/video/6Yu6JpLMWVo/видео.htmlsi=ONzq5rT1OSd0l4mD 🔥Install GraphRAG Locally - Build RAG Pipeline with Local and Global Search ruclips.net/video/Sy5K6Ay46xU/видео.htmlsi=g5eKWBsWg6zPaN7a 🔥GraphRAG with Groq - Install Locally with Local and Global Search ruclips.net/video/xkDGpR5g9D0/видео.htmlsi=QVfnD5tUSnxvPhAH 🔥GraphRAG with Llama.cpp Locally with Groq ruclips.net/video/9Gp2Qo1NASY/видео.html
@@fahdmirza Hi Fahd, I am getting an error during the entity generation step. Below are few lines of that: "type": "error", "data": "Error Invoking LLM", "stack": "Traceback (most recent call last): File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpx/_transports/default.py\", line 72, in map_httpcore_exceptions yield File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpx/_transports/default.py\", line 377, in handle_async_request resp = await self._pool.handle_async_request(req) File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpcore/_async/connection_pool.py\", line 216, in handle_async_request raise exc from None File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpcore/_async/connection_pool.py\", line 196, in handle_async_request response = await connection.handle_async_request( File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpcore/_async/connectio Any help with this would be greatly appreciated. Thanks!
I was having the api issue and also was in the 'ragtest' folder. I ran 'python3 -m graphrag.index --root .' whilst in the /ragtest directory instead of 'python3 -m graphrag.index --root ./ragtest' (15:14mins) and it seemed to work. Thank you for this video Fahd. Appreciate all the work and sharing!
Hi great Video, i had a question if you already processed a PDF document for example however few weeks down the line you need to modify the pdf, how would you update the graph to make sure that the existing pdf is cleared and the updated one is the one that is being searched?
Nice video Fahd - GraphRAG looks really good! I plan on trying it out tonight. The querying against it looks quite expensive though. I wonder if they have built in any caching approach with the query engine. I guess I better do some reading.
Thank you for the great video! I got an error that says that "No text files found in input" even though my input does have a clear *.txt file. Do you know what could be the problem?
Excellent tutorial! I was wondering if you had a chance to work with the "graphrag-accelerator" Github project that Microsoft also put out. It says it can be used as an API that has all the GraphRAG functionality but in an API.
Thanks Fahd for your hard work! Very interesting!!! 1) is it possible to link GraphRag to the local ChromaDB database ? 2) local search also works in your method or only global search ?
thaks. You would have to hack the source code to change the vector store. Yes local search also worked. Just have to replace global keyword with local.
Hi Fahd …, 1. Where does graphrag store the vectors and graphs in? I.e on local machine… 2. how do we transfer the entire graphrag app from the local machine to into the cloud….once we are done with ingestion and testing
Great job! What if I want to add another document to the GraphRAG? Should I repeat the --init procedure or is there any other method? Great video, thank you.
When run the code 'python3 -m graphing.index --root./rattiest',showers occurred during the pipeline run, See logs for more details.What to solve this problem?
API key for Ollama should be "ollama". also, no need to do the embeddings locally because their cost is not high. The main objective should be to to do the LLM part with Ollama and then enquire both globally and locally.
I got the same error as well while using local method. And also, Error embedding chunk {'OpenAIEmbedding': "'NoneType' object is not iterable"} I am using mistral and nomic-embed-text:latest for embeddings.
Issue is that `--method local` does not work out of the box with open source embedding models. It is because of the way how OpenAI's `text-embedding-3-small` model is working. It is using token IDs as input, while open source models like `nomic-embed-text` are working with text as input. So you need to convert token IDs to text before using open source models. Solution is to add one line to package's `graphrag/query/llm/oai/embedding.py` "embed" function : ```python ... def embed(self, text: str, **kwargs: Any) -> list[float]: """ Embed text using OpenAI Embedding's sync function. For text longer than max_tokens, chunk texts into max_tokens, embed each chunk, then combine using weighted average. Please refer to: github.com/openai/openai-cookbook/blob/main/examples/Embedding_long_inputs.ipynb """ token_chunks = chunk_text( text=text, token_encoder=self.token_encoder, max_tokens=self.max_tokens ) chunk_embeddings = [] chunk_lens = [] for chunk in token_chunks: # decode chunk from token ids to text (added line after row 83) chunk = self.token_encoder.decode(chunk) try: embedding, chunk_len = self._embed_with_retry(chunk, **kwargs) chunk_embeddings.append(embedding) chunk_lens.append(chunk_len) # TODO: catch a more specific exception except Exception as e: # noqa BLE001 self._reporter.error( message="Error embedding chunk", details={self.__class__.__name__: str(e)}, ) continue chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=chunk_lens) chunk_embeddings = chunk_embeddings / np.linalg.norm(chunk_embeddings) return chunk_embeddings.tolist() ... ```
Thank you for the video. I'm facing the same error as another commenter mentioned: '❌ Errors occurred during the pipeline run, see logs for more details.' Where can I find the logs?
Sure, go to this directory ~/ragtest/output/20240711-055438/reports . The date directory would vary as per your run. You would log files there. Thanks.
@@fahdmirza raise ValueError(\"Columns must be same length as key\") ValueError: Columns must be same length as key ", "source": "Columns must be same length as key", "details": null , I FACE SAME ERROR , AND I FOUND THE LOG FILES , THEY SAID
@@fahdmirza no it fails to build community reports:just tested again with mistral to make sure i have the exact same set up as you. look in the index-engine.log. 5:48:44,679 graphrag.index.graph.extractors.community_reports.community_reports_extractor ERROR error generating community report Traceback (most recent call last): File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/index/graph/extractors/community_reports/community_reports_extractor.py", line 58, in __call__ await self._llm( File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/json_parsing_llm.py", line 34, in __call__ result = await self._delegate(input, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/openai_token_replacing_llm.py", line 37, in __call__ return await self._delegate(input, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/openai_history_tracking_llm.py", line 33, in __call__ output = await self._delegate(input, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/caching_llm.py", line 104, in __call__ result = await self._delegate(input, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 177, in __call__ result, start = await execute_with_retry() File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 159, in execute_with_retry async for attempt in retryer: File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 166, in __anext__ do = await self.iter(retry_state=self._retry_state) File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 153, in iter result = await action(retry_state) File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/_utils.py", line 99, in inner return call(*args, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/__init__.py", line 398, in self._add_action_func(lambda rs: rs.outcome.result()) File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.__get_result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 165, in execute_with_retry return await do_attempt(), start File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 147, in do_attempt return await self._delegate(input, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/base_llm.py", line 48, in __call__ return await self._invoke_json(input, **kwargs) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/openai_chat_llm.py", line 90, in _invoke_json raise RuntimeError(FAILED_TO_CREATE_JSON_ERROR).......python -m graphrag.query --root . --method global "what are the top themes in this story?" INFO: Reading settings from settings.yaml creating llm client with {'api_key': 'REDACTED,len=56', 'type': "openai_chat", 'model': 'mistral', 'max_tokens': 4000, 'request_timeout': 180.0, 'api_base': 'localhost:11434/v1', 'api_version': None, 'organization': None, 'proxy': None, 'cognitive_services_endpoint': None, 'deployment_name': None, 'model_supports_json': True, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25} SUCCESS: Global Search Response: In the story, the main themes revolve around the transition of young people from formal education to practical work, specifically through apprenticeship under Ebenezer Scrooge. This transition is evident in various scenes and actions [Data: Scenes (1, 2, 3); Actions (4)]. During their apprenticeship, the young people are engaged in specific tasks or responsibilities that are likely related to Scrooge's business [Data: Actions (1-5)]. It is also suggested that Scrooge may act as a mentor or supervisor to these apprentices during this period [Data: Relationships (1-23)]. The young people are involved in various activities related to their apprenticeship, which could include tasks such as bookkeeping, accounting, or business management [Data: Actions (1-5)]. However, the exact nature of these activities is not explicitly detailed in the provided data. It is important to note that the information provided is based on the analysis of multiple reports and does not necessarily cover all aspects of the story. For a more comprehensive understanding, additional research or analysis may be required. shawn@pop-os:~/Documents/GRAPHRAG$ python -m graphrag.query --root . --method local "who is scrooge, and what are his main relationships?" INFO: Reading settings from settings.yaml creating llm client with {'api_key': 'REDACTED,len=56', 'type': "openai_chat", 'model': 'mistral', 'max_tokens': 4000, 'request_timeout': 180.0, 'api_base': 'localhost:11434/v1', 'api_version': None, 'organization': None, 'proxy': None, 'cognitive_services_endpoint': None, 'deployment_name': None, 'model_supports_json': True, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25} creating embedding llm client with {'api_key': 'REDACTED,len=56', 'type': "openai_embedding", 'model': 'nomic_embed_text', 'max_tokens': 4000, 'request_timeout': 180.0, 'api_base': 'localhost:11434/api', 'api_version': None, 'organization': None, 'proxy': None, 'cognitive_services_endpoint': None, 'deployment_name': None, 'model_supports_json': None, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25} Error embedding chunk {'OpenAIEmbedding': 'Error code: 404 - {\'error\': "model \'nomic_embed_text\' not found, try pulling it first"}'} Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/__main__.py", line 75, in run_local_search( File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/cli.py", line 154, in run_local_search result = search_engine.search(query=query) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/structured_search/local_search/search.py", line 118, in search context_text, context_records = self.context_builder.build_context( File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/structured_search/local_search/mixed_context.py", line 139, in build_context selected_entities = map_query_to_entities( File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/context_builder/entity_extraction.py", line 55, in map_query_to_entities search_results = text_embedding_vectorstore.similarity_search_by_text( File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/vector_stores/lancedb.py", line 118, in similarity_search_by_text query_embedding = text_embedder(text) File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/context_builder/entity_extraction.py", line 57, in text_embedder=lambda t: text_embedder.embed(t), File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/llm/oai/embedding.py", line 96, in embed chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=chunk_lens) File "/home/shawn/.local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 550, in average raise ZeroDivisionError( ZeroDivisionError: Weights sum to zero, can't be normalized
@fahdmirza FYI on your webpage linked w/ the commands and code snippets for this vid, you have "model: nomic_embed_text" yet "ollama pull nomic-embed-text" which leads to: Error embedding chunk {'OpenAIEmbedding': 'Error code: 404 - {\'error\': "model \'nomic_embed_text\' not found, try pulling it first"}'}
hi fahd thanks for video, getting this error : File "C:\Users\Narendrasingh\.conda\envs\graphollama\Lib\site-packages\graphrag\config\create_graphrag_config.py", line 229, in create_graphrag_config raise ApiKeyMissingError 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
perfect job. but when i try to use graphrag with ollama, error happened. logs.json shows: {"type": "error", "data": "Error Invoking LLM", "stack": "Traceback (most recent call last), and the index-engine.log shows:graphrag.index.reporting.file_workflow_callbacks INFO Error Invoking LLM does anyone know how to fix this error??
python -m graphrag.query --root ./ --method local "explain relationships between the people in the story" leads to: ./graphrag/lib/python3.12/site-packages/numpy/lib/function_base.py", line 550, in average raise ZeroDivisionError(ZeroDivisionError: Weights sum to zero, can't be normalized - and before that: Error embedding chunk {'OpenAIEmbedding': "'NoneType' object is not iterable"}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/zhenxian/Documents/XXG/github/graphrag-main/graphrag/config/create_graphrag_config.py", line 231, in create_graphrag_config raise ApiKeyMissingError 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.
Watch More GraphRAG Videos:
🔥GraphRAG with Ollama - Install Local Models for RAG - Easiest Tutorial ruclips.net/video/6Yu6JpLMWVo/видео.htmlsi=ONzq5rT1OSd0l4mD
🔥Install GraphRAG Locally - Build RAG Pipeline with Local and Global Search ruclips.net/video/Sy5K6Ay46xU/видео.htmlsi=g5eKWBsWg6zPaN7a
🔥GraphRAG with Groq - Install Locally with Local and Global Search ruclips.net/video/xkDGpR5g9D0/видео.htmlsi=QVfnD5tUSnxvPhAH
🔥GraphRAG with Llama.cpp Locally with Groq ruclips.net/video/9Gp2Qo1NASY/видео.html
GraphRAG with Ollama, entity_extraction directory is not empty but errors come... Columns must be same length as key . How to solve?
Excellent work - got a working example going!
Excellent Video, Very Helpful!! Subscribed! Thank you.
Awesome, thank you!
@@fahdmirza Hi Fahd, I am getting an error during the entity generation step.
Below are few lines of that:
"type": "error", "data": "Error Invoking LLM", "stack": "Traceback (most recent call last):
File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpx/_transports/default.py\", line 72, in map_httpcore_exceptions
yield
File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpx/_transports/default.py\", line 377, in handle_async_request
resp = await self._pool.handle_async_request(req)
File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpcore/_async/connection_pool.py\", line 216, in handle_async_request
raise exc from None
File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpcore/_async/connection_pool.py\", line 196, in handle_async_request
response = await connection.handle_async_request(
File \"/scratch/dmeher/custom_env/miniforge/envs/graphrag_env/lib/python3.10/site-packages/httpcore/_async/connectio
Any help with this would be greatly appreciated. Thanks!
Graph RAG cost a lot indeed on API calls.
One of your best video I do believe.thanks a lot
thank you
Thank you so much for this video! You are Awesome ❤
thank you
Hi @Fahad, This is simply excellent stuff. keep going
I was having the api issue and also was in the 'ragtest' folder. I ran 'python3 -m graphrag.index --root .' whilst in the /ragtest directory instead of 'python3 -m graphrag.index --root ./ragtest' (15:14mins) and it seemed to work. Thank you for this video Fahd. Appreciate all the work and sharing!
Thank you
Hi great Video, i had a question if you already processed a PDF document for example however few weeks down the line you need to modify the pdf, how would you update the graph to make sure that the existing pdf is cleared and the updated one is the one that is being searched?
Thank You from a NEW Subscriber !
Awesome, thank you!
Thank you for sharing the code.
Thank you for the video.
You're welcome
Nice video Fahd - GraphRAG looks really good! I plan on trying it out tonight. The querying against it looks quite expensive though. I wonder if they have built in any caching approach with the query engine. I guess I better do some reading.
Thank you for the great video! I got an error that says that "No text files found in input" even though my input does have a clear *.txt file. Do you know what could be the problem?
Thank you!, I am curious about visualize the knowledge graph, how to visualize it?
Excellent tutorial! I was wondering if you had a chance to work with the "graphrag-accelerator" Github project that Microsoft also put out. It says it can be used as an API that has all the GraphRAG functionality but in an API.
I think graphrag-accelerator requires Azure. If its API based, I would rather go directly to OpenAI and I have already done a video on it.
Good tutorial. Thank you for sharing the code.
Thank you
Good stuff!
thanks
Thanks Fahd for your hard work! Very interesting!!! 1) is it possible to link GraphRag to the local ChromaDB database ? 2) local search also works in your method or only global search ?
thaks. You would have to hack the source code to change the vector store. Yes local search also worked. Just have to replace global keyword with local.
Hi Fahd …, 1. Where does graphrag store the vectors and graphs in? I.e on local machine… 2. how do we transfer the entire graphrag app from the local machine to into the cloud….once we are done with ingestion and testing
It has its own built-in vector store. For migration, I would suggest installing it from scratch in cloud.
Awesome
thanks mate
Does this solution still works for anybody ?
I keep seeing this any idea ?
Errors occurred during the pipeline run, see logs for more details
Great job! What if I want to add another document to the GraphRAG? Should I repeat the --init procedure or is there any other method? Great video, thank you.
Yes, you would have to run the index procedure. Thanks.
When run the code 'python3 -m graphing.index --root./rattiest',showers occurred during the pipeline run, See logs for more details.What to solve this problem?
plz check the logs in output directory and see what the error is. Also make sure that command is correct
Thanks for latest information, Can you please also add reference for this point , "GraphRAG don't support if its less than 32k context?" 7:22
That's on basis of trial at the moment of creating video.
API key for Ollama should be "ollama". also, no need to do the embeddings locally because their cost is not high. The main objective should be to to do the LLM part with Ollama and then enquire both globally and locally.
That can be done too in various ways, but the purpose of this video to do it all in Ollama. Thanks for comment.
would you change this in the .env file or directly in the setting.yaml. I have the same issue as above where _config.py requires API key
nice! Thanks for sharing.
in case we need to use local embedding model but not as a service (without Ollama), do we still need to pass the api_base?
Yes, correct
Kindly could you show, how to use this Graph RAG with CSV data. Will be super helpful
Its the same process as any data. The cleaner your data is, the better your responses will be.
hey, i got it working, but it is giving out of context answers when I do local search, any idea what could be wrong?
first of all thank you,
ZeroDivisionError: Weights sum to zero, can't be normalized when using local method
which model you are using?
I got the same error as well while using local method. And also, Error embedding chunk {'OpenAIEmbedding': "'NoneType' object is not iterable"}
I am using mistral and nomic-embed-text:latest for embeddings.
I am also getting same error while using local method
same error with groq api llama3 8b and nomic embed text, any solution to this?
Issue is that `--method local` does not work out of the box with open source embedding models.
It is because of the way how OpenAI's `text-embedding-3-small` model is working. It is using token IDs as input, while open source models like `nomic-embed-text` are working with text as input.
So you need to convert token IDs to text before using open source models.
Solution is to add one line to package's `graphrag/query/llm/oai/embedding.py` "embed" function :
```python
...
def embed(self, text: str, **kwargs: Any) -> list[float]:
"""
Embed text using OpenAI Embedding's sync function.
For text longer than max_tokens, chunk texts into max_tokens, embed each chunk, then combine using weighted average.
Please refer to: github.com/openai/openai-cookbook/blob/main/examples/Embedding_long_inputs.ipynb
"""
token_chunks = chunk_text(
text=text, token_encoder=self.token_encoder, max_tokens=self.max_tokens
)
chunk_embeddings = []
chunk_lens = []
for chunk in token_chunks:
# decode chunk from token ids to text (added line after row 83)
chunk = self.token_encoder.decode(chunk)
try:
embedding, chunk_len = self._embed_with_retry(chunk, **kwargs)
chunk_embeddings.append(embedding)
chunk_lens.append(chunk_len)
# TODO: catch a more specific exception
except Exception as e: # noqa BLE001
self._reporter.error(
message="Error embedding chunk",
details={self.__class__.__name__: str(e)},
)
continue
chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=chunk_lens)
chunk_embeddings = chunk_embeddings / np.linalg.norm(chunk_embeddings)
return chunk_embeddings.tolist()
...
```
Thank you for the video. I'm facing the same error as another commenter mentioned: '❌ Errors occurred during the pipeline run, see logs for more details.' Where can I find the logs?
Sure, go to this directory ~/ragtest/output/20240711-055438/reports . The date directory would vary as per your run. You would log files there. Thanks.
@@fahdmirza raise ValueError(\"Columns must be same length as key\")
ValueError: Columns must be same length as key
", "source": "Columns must be same length as key", "details": null , I FACE SAME ERROR , AND I FOUND THE LOG FILES , THEY SAID
@@jiangnanfan8944 I also face the same error "ValueError(\"Columns must be same length as key\", "details": null)
@@Gadgetwars same error :(
Thanks for sharing! ... Anyone else suffering from this error: "openai.APITimeoutError: Request timed out." ??
Can you create a video on how to use GraphRAG with the GROQ API? Looks like nobody has done it yet. Thank you.
yeah just did. Thanks.
@@fahdmirza Thanks, I appreciate your work.
🔥Install GraphRAG Locally - Build RAG Pipeline with Local and Global Search ruclips.net/video/Sy5K6Ay46xU/видео.htmlsi=f-o9SyqE62OgNU14
You only did global search what about local. That is only half the rag. I got this far and thought you figured it out
Its the same process, you just need to replace global with local
@@fahdmirza no it fails to build community reports:just tested again with mistral to make sure i have the exact same set up as you. look in the index-engine.log. 5:48:44,679 graphrag.index.graph.extractors.community_reports.community_reports_extractor ERROR error generating community report
Traceback (most recent call last):
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/index/graph/extractors/community_reports/community_reports_extractor.py", line 58, in __call__
await self._llm(
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/json_parsing_llm.py", line 34, in __call__
result = await self._delegate(input, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/openai_token_replacing_llm.py", line 37, in __call__
return await self._delegate(input, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/openai_history_tracking_llm.py", line 33, in __call__
output = await self._delegate(input, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/caching_llm.py", line 104, in __call__
result = await self._delegate(input, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 177, in __call__
result, start = await execute_with_retry()
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 159, in execute_with_retry
async for attempt in retryer:
File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 166, in __anext__
do = await self.iter(retry_state=self._retry_state)
File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/tenacity/__init__.py", line 398, in
self._add_action_func(lambda rs: rs.outcome.result())
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 165, in execute_with_retry
return await do_attempt(), start
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/rate_limiting_llm.py", line 147, in do_attempt
return await self._delegate(input, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/base/base_llm.py", line 48, in __call__
return await self._invoke_json(input, **kwargs)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/llm/openai/openai_chat_llm.py", line 90, in _invoke_json
raise RuntimeError(FAILED_TO_CREATE_JSON_ERROR).......python -m graphrag.query --root . --method global "what are the top themes in this story?"
INFO: Reading settings from settings.yaml
creating llm client with {'api_key': 'REDACTED,len=56', 'type': "openai_chat", 'model': 'mistral', 'max_tokens': 4000, 'request_timeout': 180.0, 'api_base': 'localhost:11434/v1', 'api_version': None, 'organization': None, 'proxy': None, 'cognitive_services_endpoint': None, 'deployment_name': None, 'model_supports_json': True, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25}
SUCCESS: Global Search Response: In the story, the main themes revolve around the transition of young people from formal education to practical work, specifically through apprenticeship under Ebenezer Scrooge. This transition is evident in various scenes and actions [Data: Scenes (1, 2, 3); Actions (4)].
During their apprenticeship, the young people are engaged in specific tasks or responsibilities that are likely related to Scrooge's business [Data: Actions (1-5)]. It is also suggested that Scrooge may act as a mentor or supervisor to these apprentices during this period [Data: Relationships (1-23)].
The young people are involved in various activities related to their apprenticeship, which could include tasks such as bookkeeping, accounting, or business management [Data: Actions (1-5)]. However, the exact nature of these activities is not explicitly detailed in the provided data.
It is important to note that the information provided is based on the analysis of multiple reports and does not necessarily cover all aspects of the story. For a more comprehensive understanding, additional research or analysis may be required.
shawn@pop-os:~/Documents/GRAPHRAG$ python -m graphrag.query --root . --method local "who is scrooge, and what are his main relationships?"
INFO: Reading settings from settings.yaml
creating llm client with {'api_key': 'REDACTED,len=56', 'type': "openai_chat", 'model': 'mistral', 'max_tokens': 4000, 'request_timeout': 180.0, 'api_base': 'localhost:11434/v1', 'api_version': None, 'organization': None, 'proxy': None, 'cognitive_services_endpoint': None, 'deployment_name': None, 'model_supports_json': True, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25}
creating embedding llm client with {'api_key': 'REDACTED,len=56', 'type': "openai_embedding", 'model': 'nomic_embed_text', 'max_tokens': 4000, 'request_timeout': 180.0, 'api_base': 'localhost:11434/api', 'api_version': None, 'organization': None, 'proxy': None, 'cognitive_services_endpoint': None, 'deployment_name': None, 'model_supports_json': None, 'tokens_per_minute': 0, 'requests_per_minute': 0, 'max_retries': 10, 'max_retry_wait': 10.0, 'sleep_on_rate_limit_recommendation': True, 'concurrent_requests': 25}
Error embedding chunk {'OpenAIEmbedding': 'Error code: 404 - {\'error\': "model \'nomic_embed_text\' not found, try pulling it first"}'}
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/__main__.py", line 75, in
run_local_search(
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/cli.py", line 154, in run_local_search
result = search_engine.search(query=query)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/structured_search/local_search/search.py", line 118, in search
context_text, context_records = self.context_builder.build_context(
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/structured_search/local_search/mixed_context.py", line 139, in build_context
selected_entities = map_query_to_entities(
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/context_builder/entity_extraction.py", line 55, in map_query_to_entities
search_results = text_embedding_vectorstore.similarity_search_by_text(
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/vector_stores/lancedb.py", line 118, in similarity_search_by_text
query_embedding = text_embedder(text)
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/context_builder/entity_extraction.py", line 57, in
text_embedder=lambda t: text_embedder.embed(t),
File "/home/shawn/.local/lib/python3.10/site-packages/graphrag/query/llm/oai/embedding.py", line 96, in embed
chunk_embeddings = np.average(chunk_embeddings, axis=0, weights=chunk_lens)
File "/home/shawn/.local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 550, in average
raise ZeroDivisionError(
ZeroDivisionError: Weights sum to zero, can't be normalized
Thanks for the video.
Can i use mxbai from ollama for embedding purposes... or is there a limitation on that?
sure you can use it.
Langchain+neo4j+chroma = MS graphrag …. Correct?
Please explore this repo github.com/microsoft/graphrag for underlying tech. Thanks.
@fahdmirza FYI on your webpage linked w/ the commands and code snippets for this vid, you have "model: nomic_embed_text" yet "ollama pull nomic-embed-text" which leads to: Error embedding chunk {'OpenAIEmbedding': 'Error code: 404 - {\'error\': "model \'nomic_embed_text\' not found, try pulling it first"}'}
hi fahd thanks for video, getting this error : File "C:\Users\Narendrasingh\.conda\envs\graphollama\Lib\site-packages\graphrag\config\create_graphrag_config.py", line 229, in
create_graphrag_config
raise ApiKeyMissingError
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
Same issue here...below states to use "ollama" as API key. In which file should this be indicated?
perfect job. but when i try to use graphrag with ollama, error happened. logs.json shows: {"type": "error", "data": "Error Invoking LLM", "stack": "Traceback (most recent call last), and the index-engine.log shows:graphrag.index.reporting.file_workflow_callbacks INFO Error Invoking LLM
does anyone know how to fix this error??
same issue
Reload the input
python -m graphrag.query --root ./ --method local "explain relationships between the people in the story" leads to: ./graphrag/lib/python3.12/site-packages/numpy/lib/function_base.py", line 550, in average
raise ZeroDivisionError(ZeroDivisionError: Weights sum to zero, can't be normalized - and before that: Error embedding chunk {'OpenAIEmbedding': "'NoneType' object is not iterable"}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zhenxian/Documents/XXG/github/graphrag-main/graphrag/config/create_graphrag_config.py", line 231, in create_graphrag_config
raise ApiKeyMissingError
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.
got the same error