cleaning code for pull
This commit is contained in:
@@ -1,27 +1,3 @@
|
||||
print ("init package vars here. ......")
|
||||
# from .neo4j import GraphStorage as Neo4JStorage
|
||||
# print ("init package vars here. ......")
|
||||
|
||||
|
||||
# import sys
|
||||
# import importlib
|
||||
# # Specify the path to the directory containing the module
|
||||
# # Add the directory to the system path
|
||||
# module_dir = '/Users/kenwiltshire/documents/dev/LightRag/lightrag/kg'
|
||||
# sys.path.append(module_dir)
|
||||
# # Specify the module name
|
||||
# module_name = 'neo4j'
|
||||
# # Import the module
|
||||
# spec = importlib.util.spec_from_file_location(module_name, f'{module_dir}/{module_name}.py')
|
||||
|
||||
# Neo4JStorage = importlib.util.module_from_spec(spec)
|
||||
# spec.loader.exec_module(Neo4JStorage)
|
||||
|
||||
|
||||
|
||||
# Relative imports are still possible by adding a leading period to the module name when using the from ... import form:
|
||||
|
||||
# # Import names from pkg.string
|
||||
# from .string import name1, name2
|
||||
# # Import pkg.string
|
||||
# from . import string
|
||||
|
||||
|
@@ -120,9 +120,6 @@ class LightRAG:
|
||||
addon_params: dict = field(default_factory=dict)
|
||||
convert_response_to_json_func: callable = convert_response_to_json
|
||||
|
||||
# def get_configured_KG(self):
|
||||
# return self.kg
|
||||
|
||||
def __post_init__(self):
|
||||
log_file = os.path.join(self.working_dir, "lightrag.log")
|
||||
set_logger(log_file)
|
||||
@@ -133,7 +130,7 @@ class LightRAG:
|
||||
_print_config = ",\n ".join([f"{k} = {v}" for k, v in asdict(self).items()])
|
||||
logger.debug(f"LightRAG init with param:\n {_print_config}\n")
|
||||
|
||||
#should move all storage setup here to leverage initial start params attached to self.
|
||||
#@TODO: should move all storage setup here to leverage initial start params attached to self.
|
||||
self.graph_storage_cls: Type[BaseGraphStorage] = self._get_storage_class()[self.kg]
|
||||
|
||||
if not os.path.exists(self.working_dir):
|
||||
|
@@ -72,9 +72,7 @@ async def openai_complete_if_cache(
|
||||
|
||||
@retry(
|
||||
stop=stop_after_attempt(3),
|
||||
#kw_
|
||||
wait=wait_exponential(multiplier=1, min=10, max=60),
|
||||
# wait=wait_exponential(multiplier=1, min=4, max=10),
|
||||
wait=wait_exponential(multiplier=1, min=4, max=10),
|
||||
retry=retry_if_exception_type((RateLimitError, APIConnectionError, Timeout)),
|
||||
)
|
||||
async def azure_openai_complete_if_cache(model,
|
||||
|
@@ -908,7 +908,6 @@ async def hybrid_query(
|
||||
.strip()
|
||||
)
|
||||
result = "{" + result.split("{")[1].split("}")[0] + "}"
|
||||
|
||||
keywords_data = json.loads(result)
|
||||
hl_keywords = keywords_data.get("high_level_keywords", [])
|
||||
ll_keywords = keywords_data.get("low_level_keywords", [])
|
||||
|
@@ -95,7 +95,6 @@ class NanoVectorDBStorage(BaseVectorStorage):
|
||||
embeddings = np.concatenate(embeddings_list)
|
||||
for i, d in enumerate(list_data):
|
||||
d["__vector__"] = embeddings[i]
|
||||
print (f"Upserting to vector: {list_data}")
|
||||
results = self._client.upsert(datas=list_data)
|
||||
return results
|
||||
|
||||
@@ -110,7 +109,6 @@ class NanoVectorDBStorage(BaseVectorStorage):
|
||||
results = [
|
||||
{**dp, "id": dp["__id__"], "distance": dp["__metrics__"]} for dp in results
|
||||
]
|
||||
print (f"vector db results {results} for query {query}")
|
||||
return results
|
||||
|
||||
async def index_done_callback(self):
|
||||
@@ -235,9 +233,11 @@ class NetworkXStorage(BaseGraphStorage):
|
||||
raise ValueError(f"Node embedding algorithm {algorithm} not supported")
|
||||
return await self._node_embed_algorithms[algorithm]()
|
||||
|
||||
|
||||
#@TODO: NOT USED
|
||||
async def _node2vec_embed(self):
|
||||
from graspologic import embed
|
||||
print ("is this ever called?")
|
||||
|
||||
embeddings, nodes = embed.node2vec_embed(
|
||||
self._graph,
|
||||
**self.global_config["node2vec_params"],
|
||||
|
Reference in New Issue
Block a user