support Oracle Database storage
This commit is contained in:
@@ -22,7 +22,7 @@ This repository hosts the code of LightRAG. The structure of this code is based
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
## 🎉 News
|
## 🎉 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.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.29]🎯📢LightRAG now supports multiple file types, including PDF, DOC, PPT, and CSV via `textract`.
|
||||||
- [x] [2024.10.20]🎯📢We’ve added a new feature to LightRAG: Graph Visualization.
|
- [x] [2024.10.20]🎯📢We’ve added a new feature to LightRAG: Graph Visualization.
|
||||||
|
@@ -116,7 +116,7 @@ async def main():
|
|||||||
modes = ["naive", "local", "global", "hybrid"]
|
modes = ["naive", "local", "global", "hybrid"]
|
||||||
for mode in modes:
|
for mode in modes:
|
||||||
print("="*20, mode, "="*20)
|
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")
|
print("-"*100, "\n")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@@ -34,7 +34,6 @@ from .base import (
|
|||||||
QueryParam,
|
QueryParam,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
from .storage import (
|
from .storage import (
|
||||||
JsonKVStorage,
|
JsonKVStorage,
|
||||||
NanoVectorDBStorage,
|
NanoVectorDBStorage,
|
||||||
@@ -116,15 +115,7 @@ class LightRAG:
|
|||||||
llm_model_kwargs: dict = field(default_factory=dict)
|
llm_model_kwargs: dict = field(default_factory=dict)
|
||||||
|
|
||||||
# storage
|
# storage
|
||||||
|
|
||||||
vector_db_storage_cls_kwargs: dict = field(default_factory=dict)
|
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
|
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.
|
# @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.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):
|
if not os.path.exists(self.working_dir):
|
||||||
logger.info(f"Creating working directory {self.working_dir}")
|
logger.info(f"Creating working directory {self.working_dir}")
|
||||||
os.makedirs(self.working_dir)
|
os.makedirs(self.working_dir)
|
||||||
@@ -210,14 +200,17 @@ class LightRAG:
|
|||||||
|
|
||||||
def _get_storage_class(self) -> Type[BaseGraphStorage]:
|
def _get_storage_class(self) -> Type[BaseGraphStorage]:
|
||||||
return {
|
return {
|
||||||
|
# kv storage
|
||||||
"JsonKVStorage":JsonKVStorage,
|
"JsonKVStorage":JsonKVStorage,
|
||||||
"OracleKVStorage":OracleKVStorage,
|
"OracleKVStorage":OracleKVStorage,
|
||||||
|
|
||||||
|
# vector storage
|
||||||
"NanoVectorDBStorage":NanoVectorDBStorage,
|
"NanoVectorDBStorage":NanoVectorDBStorage,
|
||||||
"OracleVectorDBStorage":OracleVectorDBStorage,
|
"OracleVectorDBStorage":OracleVectorDBStorage,
|
||||||
|
|
||||||
"Neo4JStorage": Neo4JStorage,
|
# graph storage
|
||||||
"NetworkXStorage": NetworkXStorage,
|
"NetworkXStorage": NetworkXStorage,
|
||||||
|
"Neo4JStorage": Neo4JStorage,
|
||||||
"OracleGraphStorage": OracleGraphStorage,
|
"OracleGraphStorage": OracleGraphStorage,
|
||||||
# "ArangoDBStorage": ArangoDBStorage
|
# "ArangoDBStorage": ArangoDBStorage
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user