support Oracle Database storage

This commit is contained in:
jin
2024-11-08 16:12:58 +08:00
parent 32cf860b83
commit 5e9d19d5a3
3 changed files with 8 additions and 15 deletions

View File

@@ -22,7 +22,7 @@ This repository hosts the code of LightRAG. The structure of this code is based
</div>
## 🎉 News
- [x] [2024.11.08]🎯📢You can [use Oracle Database 23ai for Storage](https://github.com/HKUDS/LightRAG/blob/main/examples/lightrag_oracle_demo.py) now.
- [x] [2024.11.08]🎯📢You can [use Oracle Database 23ai for all storage types (kv/vector/graph)](https://github.com/HKUDS/LightRAG/blob/main/examples/lightrag_oracle_demo.py) now.
- [x] [2024.11.04]🎯📢You can [use Neo4J for Storage](https://github.com/HKUDS/LightRAG?tab=readme-ov-file#using-neo4j-for-storage) now.
- [x] [2024.10.29]🎯📢LightRAG now supports multiple file types, including PDF, DOC, PPT, and CSV via `textract`.
- [x] [2024.10.20]🎯📢Weve added a new feature to LightRAG: Graph Visualization.

View File

@@ -116,7 +116,7 @@ async def main():
modes = ["naive", "local", "global", "hybrid"]
for mode in modes:
print("="*20, mode, "="*20)
print(await rag.aquery("这个文章讲了什么?", param=QueryParam(mode=mode)))
print(await rag.aquery("What are the top themes in this story?", param=QueryParam(mode=mode)))
print("-"*100, "\n")
except Exception as e:

View File

@@ -34,7 +34,6 @@ from .base import (
QueryParam,
)
from .storage import (
JsonKVStorage,
NanoVectorDBStorage,
@@ -116,15 +115,7 @@ class LightRAG:
llm_model_kwargs: dict = field(default_factory=dict)
# storage
vector_db_storage_cls_kwargs: dict = field(default_factory=dict)
# if DATABASE_TYPE is None:
# key_string_value_json_storage_cls: Type[BaseKVStorage] = JsonKVStorage
# vector_db_storage_cls: Type[BaseVectorStorage] = NanoVectorDBStorage
# vector_db_storage_cls_kwargs: dict = field(default_factory=dict)
# elif DATABASE_TYPE == "oracle":
# key_string_value_json_storage_cls: Type[BaseKVStorage] = OracleKVStorage,
# vector_db_storage_cls: Type[BaseVectorStorage] = OracleVectorDBStorage,
enable_llm_cache: bool = True
@@ -144,11 +135,10 @@ class LightRAG:
# @TODO: should move all storage setup here to leverage initial start params attached to self.
self. key_string_value_json_storage_cls: Type[BaseKVStorage] = self._get_storage_class()[self.kv_storage]
self.key_string_value_json_storage_cls: Type[BaseKVStorage] = self._get_storage_class()[self.kv_storage]
self.vector_db_storage_cls: Type[BaseVectorStorage] = self._get_storage_class()[self.vector_storage]
self.graph_storage_cls: Type[BaseGraphStorage] = self._get_storage_class()[self.graph_storage]
self.vector_db_storage_cls: Type[BaseVectorStorage] = self._get_storage_class()[self.vector_storage]
if not os.path.exists(self.working_dir):
logger.info(f"Creating working directory {self.working_dir}")
os.makedirs(self.working_dir)
@@ -210,14 +200,17 @@ class LightRAG:
def _get_storage_class(self) -> Type[BaseGraphStorage]:
return {
# kv storage
"JsonKVStorage":JsonKVStorage,
"OracleKVStorage":OracleKVStorage,
# vector storage
"NanoVectorDBStorage":NanoVectorDBStorage,
"OracleVectorDBStorage":OracleVectorDBStorage,
"Neo4JStorage": Neo4JStorage,
# graph storage
"NetworkXStorage": NetworkXStorage,
"Neo4JStorage": Neo4JStorage,
"OracleGraphStorage": OracleGraphStorage,
# "ArangoDBStorage": ArangoDBStorage
}