diff --git a/graphrag/general/graph_extractor.py b/graphrag/general/graph_extractor.py index 375327bfa..88c1f1e62 100644 --- a/graphrag/general/graph_extractor.py +++ b/graphrag/general/graph_extractor.py @@ -130,8 +130,9 @@ class GraphExtractor(Extractor): async with chat_limiter: continuation = await trio.to_thread.run_sync(lambda: self._chat("", history, {"temperature": 0.8})) token_count += num_tokens_from_string("\n".join([m["content"] for m in history]) + response) - if continuation != "YES": + if continuation != "Y": break + history.append({"role": "assistant", "content": "Y"}) records = split_string_by_multi_markers( results, diff --git a/graphrag/general/graph_prompt.py b/graphrag/general/graph_prompt.py index 3472bc734..54ca3a1d3 100644 --- a/graphrag/general/graph_prompt.py +++ b/graphrag/general/graph_prompt.py @@ -106,7 +106,7 @@ Text: {input_text} Output:""" CONTINUE_PROMPT = "MANY entities were missed in the last extraction. Add them below using the same format:\n" -LOOP_PROMPT = "It appears some entities may have still been missed. Answer YES | NO if there are still entities that need to be added.\n" +LOOP_PROMPT = "It appears some entities may have still been missed. Answer Y if there are still entities that need to be added, or N if there are none. Please answer with a single letter Y or N.\n" SUMMARIZE_DESCRIPTIONS_PROMPT = """ You are a helpful assistant responsible for generating a comprehensive summary of the data provided below.