瀏覽代碼

Remove redandent code. (#5121)

### What problem does this PR solve?

#5107

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.17.0
Kevin Hu 8 月之前
父節點
當前提交
ef95f08c48
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 2 行新增5 行删除
  1. 2
    5
      graphrag/general/community_reports_extractor.py

+ 2
- 5
graphrag/general/community_reports_extractor.py 查看文件

import logging import logging
import json import json
import re import re
import traceback
from typing import Callable from typing import Callable
from dataclasses import dataclass from dataclasses import dataclass
import networkx as nx import networkx as nx
from graphrag.general.extractor import Extractor from graphrag.general.extractor import Extractor
from graphrag.general.leiden import add_community_info2graph from graphrag.general.leiden import add_community_info2graph
from rag.llm.chat_model import Base as CompletionLLM from rag.llm.chat_model import Base as CompletionLLM
from graphrag.utils import ErrorHandlerFn, perform_variable_replacements, dict_has_keys_with_types
from graphrag.utils import perform_variable_replacements, dict_has_keys_with_types
from rag.utils import num_tokens_from_string from rag.utils import num_tokens_from_string
from timeit import default_timer as timer from timeit import default_timer as timer




_extraction_prompt: str _extraction_prompt: str
_output_formatter_prompt: str _output_formatter_prompt: str
_on_error: ErrorHandlerFn
_max_report_length: int _max_report_length: int


def __init__( def __init__(
continue continue
response["weight"] = weight response["weight"] = weight
response["entities"] = ents response["entities"] = ents
except Exception as e:
except Exception:
logging.exception("CommunityReportsExtractor got exception") logging.exception("CommunityReportsExtractor got exception")
self._on_error(e, traceback.format_exc(), None)
continue continue


add_community_info2graph(graph, ents, response["title"]) add_community_info2graph(graph, ents, response["title"])

Loading…
取消
儲存