Skip to content

Commit

Permalink
fix: GRAPH_COMMUNITY_SUMMARY_ENABLED = False error. (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aries-ckt authored Oct 22, 2024
1 parent d9e2042 commit 6c682be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dbgpt/rag/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ async def aload_document_with_limit(
max_threads,
)

@abstractmethod
def similar_search(
self, text: str, topk: int, filters: Optional[MetadataFilters] = None
) -> List[Chunk]:
Expand All @@ -197,6 +196,7 @@ def similar_search(
Return:
List[Chunk]: The similar documents.
"""
return self.similar_search_with_scores(text, topk, 1.0, filters)

async def asimilar_search(
self,
Expand Down
14 changes: 0 additions & 14 deletions dbgpt/storage/knowledge_graph/community_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,6 @@ def _load_chunks(

return doc_chunk, chunks

def similar_search(
self, text: str, topk: int, filters: Optional[MetadataFilters] = None
) -> List[Chunk]:
"""Similar search in index database.
Args:
text(str): The query text.
topk(int): The number of similar documents to return.
filters(Optional[MetadataFilters]): metadata filters.
Return:
List[Chunk]: The similar documents.
"""
return []

async def asimilar_search_with_scores(
self,
text,
Expand Down
9 changes: 3 additions & 6 deletions examples/rag/graph_rag_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
)

"""GraphRAG example.
pre-requirements:
* Set LLM config (url/sk) in `.env`.
* Install pytest utils: `pip install pytest pytest-asyncio`
* Config TuGraph following the format below.
```
# Set LLM config (url/sk) in `.env`.
# Install pytest utils: `pip install pytest pytest-asyncio`
GRAPH_STORE_TYPE=TuGraph
TUGRAPH_HOST=127.0.0.1
TUGRAPH_PORT=7687
Expand Down Expand Up @@ -88,8 +86,7 @@ def __create_community_kg_connector():

async def ask_chunk(chunk: Chunk, question) -> str:
rag_template = (
"Based on the following [Context] {context}, "
"answer [Question] {question}."
"Based on the following [Context] {context}, " "answer [Question] {question}."
)
template = HumanPromptTemplate.from_template(rag_template)
messages = template.format_messages(context=chunk.content, question=question)
Expand Down

0 comments on commit 6c682be

Please sign in to comment.