fix: GRAPH_COMMUNITY_SUMMARY_ENABLED = False error. (#2086)

This commit is contained in:
Aries-ckt 2024-10-22 11:16:01 +08:00 committed by GitHub
parent d9e20426fe
commit 6c682befa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 21 deletions

View File

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

View File

@ -268,20 +268,6 @@ class CommunitySummaryKnowledgeGraph(BuiltinKnowledgeGraph):
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,

View File

@ -20,11 +20,9 @@ from dbgpt.storage.knowledge_graph.knowledge_graph import (
)
"""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
@ -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)