fix bug
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ local_neo4jWorkDir/
|
||||
neo4jWorkDir/
|
||||
ignore_this.txt
|
||||
.venv/
|
||||
*.ignore.*
|
||||
|
@@ -84,7 +84,7 @@ class BaseKVStorage(Generic[T], StorageNameSpace):
|
||||
|
||||
@dataclass
|
||||
class BaseGraphStorage(StorageNameSpace):
|
||||
embedding_func: EmbeddingFunc
|
||||
embedding_func: EmbeddingFunc = None
|
||||
async def has_node(self, node_id: str) -> bool:
|
||||
raise NotImplementedError
|
||||
|
||||
|
@@ -16,6 +16,7 @@ from .utils import (
|
||||
split_string_by_multi_markers,
|
||||
truncate_list_by_token_size,
|
||||
process_combine_contexts,
|
||||
locate_json_string_body_from_string
|
||||
)
|
||||
from .base import (
|
||||
BaseGraphStorage,
|
||||
@@ -403,9 +404,10 @@ async def local_query(
|
||||
kw_prompt_temp = PROMPTS["keywords_extraction"]
|
||||
kw_prompt = kw_prompt_temp.format(query=query)
|
||||
result = await use_model_func(kw_prompt)
|
||||
json_text = locate_json_string_body_from_string(result)
|
||||
|
||||
try:
|
||||
keywords_data = json.loads(result)
|
||||
keywords_data = json.loads(json_text)
|
||||
keywords = keywords_data.get("low_level_keywords", [])
|
||||
keywords = ", ".join(keywords)
|
||||
except json.JSONDecodeError:
|
||||
@@ -670,9 +672,10 @@ async def global_query(
|
||||
kw_prompt_temp = PROMPTS["keywords_extraction"]
|
||||
kw_prompt = kw_prompt_temp.format(query=query)
|
||||
result = await use_model_func(kw_prompt)
|
||||
json_text = locate_json_string_body_from_string(result)
|
||||
|
||||
try:
|
||||
keywords_data = json.loads(result)
|
||||
keywords_data = json.loads(json_text)
|
||||
keywords = keywords_data.get("high_level_keywords", [])
|
||||
keywords = ", ".join(keywords)
|
||||
except json.JSONDecodeError:
|
||||
@@ -911,8 +914,9 @@ async def hybrid_query(
|
||||
kw_prompt = kw_prompt_temp.format(query=query)
|
||||
|
||||
result = await use_model_func(kw_prompt)
|
||||
json_text = locate_json_string_body_from_string(result)
|
||||
try:
|
||||
keywords_data = json.loads(result)
|
||||
keywords_data = json.loads(json_text)
|
||||
hl_keywords = keywords_data.get("high_level_keywords", [])
|
||||
ll_keywords = keywords_data.get("low_level_keywords", [])
|
||||
hl_keywords = ", ".join(hl_keywords)
|
||||
|
@@ -14,7 +14,7 @@ Given a text document that is potentially relevant to this activity and a list o
|
||||
|
||||
-Steps-
|
||||
1. Identify all entities. For each identified entity, extract the following information:
|
||||
- entity_name: Name of the entity, capitalized
|
||||
- entity_name: Name of the entity, use same language as input text. If English, capitalized the name.
|
||||
- entity_type: One of the following types: [{entity_types}]
|
||||
- entity_description: Comprehensive description of the entity's attributes and activities
|
||||
Format each entity as ("entity"{tuple_delimiter}<entity_name>{tuple_delimiter}<entity_type>{tuple_delimiter}<entity_description>
|
||||
|
Reference in New Issue
Block a user