LightRAG icon indicating copy to clipboard operation
LightRAG copied to clipboard

[Question]:i cannot get the answer and the output is "LLM output format error; found 6/5 fields on REALTION"

Open tianma-afk opened this issue 2 months ago • 2 comments

Do you need to ask a question?

  • [x] I have searched the existing question and discussions and this question is not already answered.
  • [ ] I believe this is a legitimate question, not just a bug or feature request.

Your Question

My English is not good .But I know to say thankyou for my sage.Please Help me! I try to run the program just like the official video show.But defeat. First I download the nomic-embed-text and qwen2. Then I change the num_ctx to 32768 just like the official video. final I run the program. the first problem that the embeding vector in the program is not the same as the nomic-embed-text in the original program it is 1024 ,but the nomic-embed-text is 768

so the program show ERROR. then my change is below embedding_func=EmbeddingFunc( embedding_dim=int(os.getenv("EMBEDDING_DIM", "1024")), max_token_size=int(os.getenv("MAX_EMBED_TOKENS", "8192")), func=lambda texts: ollama_embed( texts, embed_model=os.getenv("EMBEDDING_MODEL", "nomic-embed-text"), host=os.getenv("EMBEDDING_BINDING_HOST", "http://localhost:11434"), ) to embedding_func=EmbeddingFunc( embedding_dim=int(os.getenv("EMBEDDING_DIM", "768")), max_token_size=int(os.getenv("MAX_EMBED_TOKENS", "8192")), func=lambda texts: ollama_embed( texts, embed_model=os.getenv("EMBEDDING_MODEL", "nomic-embed-text"), host=os.getenv("EMBEDDING_BINDING_HOST", "http://localhost:11434"), )

after the change , the error can be solved .I run the program again ,this time it took long time...... and bring me many warnings

WARNING: chunk-43c9bee23adfa77aa9dedd22401bba7d: LLM output format error; found 6/5 fields on REALTION Scrooge~festival memory evocation trigger`

WARNING: chunk-43c9bee23adfa77aa9dedd22401bba7d: LLM output format error; found 6/5 fields on REALTION Illustration~festival scene visualization

WARNING: chunk-43c9bee23adfa77aa9dedd22401bba7d: LLM output format error; found 6/5 fields on REALTION Scrooge~emotional awakening catalyst

WARNING: chunk-43c9bee23adfa77aa9dedd22401bba7d: LLM output format error; found 6/5 fields on REALTION Illustration~festival scene representation

WARNING: chunk-43c9bee23adfa77aa9dedd22401bba7d: LLM output format error; found 6/5 fields on REALTION Scrooge~`emotional development trigger during festivals``

**finally i get the result as the additional context show. I find the warning code below **

async def _handle_single_relationship_extraction( record_attributes: list[str], chunk_key: str, timestamp: int, file_path: str = "unknown_source", ): if ( len(record_attributes) != 5 or "relation" not in record_attributes[0] ): # treat "relationship" and "relation" interchangeable if len(record_attributes) > 1 and "relation" in record_attributes[0]: logger.warning( f"{chunk_key}: LLM output format error; found {len(record_attributes)}/5 fields on REALTION {record_attributes[1]}~{record_attributes[2] if len(record_attributes) > 2 else 'N/A'}" ) logger.debug(record_attributes) return None

but i don't know how to solve.

Additional Context

`httpcore.ReadTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\operate.py", line 2186, in process_with_semaphore return await process_single_content(chunk) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\operate.py", line 2079, in process_single_content final_result, timestamp = await use_llm_func_with_cache( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<7 lines>... ) ^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\utils.py", line 1686, in use_llm_func_with_cache res: str = await use_llm_func( ^^^^^^^^^^^^^^^^^^^ safe_user_prompt, system_prompt=safe_system_prompt, **kwargs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\utils.py", line 835, in wait_func return await future ^^^^^^^^^^^^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\utils.py", line 539, in worker result = await asyncio.wait_for( ^^^^^^^^^^^^^^^^^^^^^^^ func(*args, **kwargs), timeout=max_execution_timeout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "D:\MiniConda\Lib\asyncio\tasks.py", line 507, in wait_for return await fut ^^^^^^^^^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\llm\ollama.py", line 135, in ollama_model_complete return await ollama_model_if_cache( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<6 lines>... ) ^ File "D:\MiniConda\Lib\site-packages\tenacity\asyncio_init.py", line 189, in async_wrapped return await copy(fn, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\tenacity\asyncio_init.py", line 111, in call do = await self.iter(retry_state=retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\tenacity\asyncio_init.py", line 153, in iter result = await action(retry_state) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\tenacity_utils.py", line 99, in inner return call(*args, **kwargs) File "D:\MiniConda\Lib\site-packages\tenacity_init.py", line 400, in self._add_action_func(lambda rs: rs.outcome.result()) ~~~~~~~~~~~~~~~~~^^ File "D:\MiniConda\Lib\concurrent\futures_base.py", line 449, in result return self.__get_result() ~~~~~~~~~~~~~~~~~^^ File "D:\MiniConda\Lib\concurrent\futures_base.py", line 401, in __get_result raise self.exception File "D:\MiniConda\Lib\site-packages\tenacity\asyncio_init.py", line 114, in call result = await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\llm\ollama.py", line 109, in _ollama_model_if_cache raise e File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\llm\ollama.py", line 72, in _ollama_model_if_cache response = await ollama_client.chat(model=model, messages=messages, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\ollama_client.py", line 953, in chat return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<14 lines>... ) ^ File "D:\MiniConda\Lib\site-packages\ollama_client.py", line 751, in _request return cls((await self._request_raw(*args, **kwargs)).json()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\ollama_client.py", line 691, in _request_raw r = await self._client.request(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\httpx_client.py", line 1540, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\httpx_client.py", line 1629, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<4 lines>... ) ^ File "D:\MiniConda\Lib\site-packages\httpx_client.py", line 1657, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... ) ^ File "D:\MiniConda\Lib\site-packages\httpx_client.py", line 1694, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\httpx_client.py", line 1730, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\MiniConda\Lib\site-packages\httpx_transports\default.py", line 393, in handle_async_request with map_httpcore_exceptions(): ~~~~~~~~~~~~~~~~~~~~~~~^^ File "D:\MiniConda\Lib\contextlib.py", line 162, in exit self.gen.throw(value) ~~~~~~~~~~~~~~^^^^^^^ File "D:\MiniConda\Lib\site-packages\httpx_transports\default.py", line 118, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\operate.py", line 2190, in _process_with_semaphore raise prefixed_exception from e httpx.ReadTimeout: chunk-e7637ff18c5ded77a68cce0a87883fad:

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\lightrag.py", line 1604, in process_document await entity_relation_task File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\lightrag.py", line 1829, in _process_extract_entities raise e File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\lightrag.py", line 1814, in _process_extract_entities chunk_results = await extract_entities( ^^^^^^^^^^^^^^^^^^^^^^^ ...<6 lines>... ) ^ File "C:\Users\sun\Desktop\all\pythoncode\LightRAG\lightrag\operate.py", line 2232, in extract_entities raise prefixed_exception from first_exception httpx.ReadTimeout: C[25/42]: chunk-e7637ff18c5ded77a68cce0a87883fad:

ERROR: Failed to extract document 1/1: unknown_source INFO: Enqueued document processing pipeline stoped

===================== Query mode: naive

INFO: Naive query: 20 chunks (chunk_top_k:20 cosine:0.2) WARNING: Rerank is enabled but no rerank model is configured. Please set up a rerank model or set enable_rerank=False in query parameters. INFO: Final context: 20 chunks I'm sorry, but I can't provide an answer because you haven't provided a specific story for me to analyze. If you give me the name of the story or include its content, I'll be able to identify and list the main themes for you.

Query mode: local

WARNING: low_level_keywords is empty INFO: Query edges: Top themes, Story analysis (top_k:40, cosine:0.2) INFO: Raw search results: 0 entities, 0 relations, 0 vector chunks INFO: [kg_query] No query context could be built; returning no-result. Sorry, I'm not able to provide an answer to that question.[no-context]

===================== Query mode: global

INFO: Query edges: top themes, story (top_k:40, cosine:0.2) INFO: Raw search results: 0 entities, 0 relations, 0 vector chunks INFO: [kg_query] No query context could be built; returning no-result. Sorry, I'm not able to provide an answer to that question.[no-context]

===================== Query mode: hybrid

WARNING: low_level_keywords is empty INFO: Query edges: Top themes, Story, Themes (top_k:40, cosine:0.2) INFO: Raw search results: 0 entities, 0 relations, 0 vector chunks INFO: [kg_query] No query context could be built; returning no-result. Sorry, I'm not able to provide an answer to that question.[no-context] INFO: Successfully finalized 10 storages

Done!`

tianma-afk avatar Oct 23 '25 07:10 tianma-afk

  1. Embedding Dimension Mismatch You correctly changed the embedding dimension from 1024 to 768 to match nomic-embed-text, which outputs 768-dimensional vectors. However, you must also clear your old vector database before re-running LightRAG. Otherwise, old data encoded with 1024 dimensions will conflict with the new 768-vector schema. If you ever switch embedding models again, delete or rename the data directory before new runs.

  2. Warnings: “LLM output format error; found 6/5 fields” etc These warnings happen because the LLM returns slightly malformed structured data. for example, six text fields for a “relation” where the parser expects five. This is not tooo bad, but means the model’s output doesn’t fully match the expected structure. fix:

  • lower chunk_size or temperature in your LLM config. shorter chunks reduce structured output drift.​
  • try a different (better) model
  • Ignore warnings if only occasional (they mainly reduce relationship graph accuracy).
  1. Timout errors like httpx.ReadTimeout from ollama_model_complete; This means LightRAG waited too long for Ollama’s reply. probable causes:
  • Ollama process is busy, frozen, or unreachable
  • Context is too large for your hardware
  • Context settings in ollama are to low
  • Your hardware is underpowered
  1. No answer because no documents found Your Knowledge Graph is empty. This is because processing failed due to timeouts. After fixing timeouts, you need to reprocess your documents.

superuely avatar Oct 24 '25 10:10 superuely

really thank you for your help .

i change the chunk_size to 256 Also i change the book.txt to a short Chinese story. Then the result is ok .

the output is below .

  1. Narrative Structure: The telling and the being told parts within the text indicate that storytelling is central to this scenario.
  2. Setting: Mention of "a mountain" suggests that natural landscapes play a role in the story's setting, which might contribute to themes like solitude or adventure.
  3. Characters: The involvement of an "old man", a "little man", and a "little rabbit" could imply themes related to wisdom being passed down (from the old man), youth experiencing or observing these tales, and perhaps innocence or naivety.

Given this information:

  • Theme 1: Generational Wisdom might emerge from the interaction between the old man who tells stories and the little man who listens.
  • Theme 2: Nature as a Setting could highlight themes like the impact of natural landscapes on human narratives, such as isolation or inspiration.

To conclusively identify the top theme without more context is challenging, but considering these elements suggests that themes related to storytelling, wisdom transfer, and perhaps nature might be prominent in this story. Without specific details about the plot's development and conflicts, it's difficult to pinpoint a single "top theme". INFO: Successfully finalized 12 storages

thank you for you again

tianma-afk avatar Nov 21 '25 13:11 tianma-afk