feat: include light rag build in Docker (#475) #none

* feat: update docker build for lightrag

* feat: update docker build

* feat: update docker build
This commit is contained in:
Tuan Anh Nguyen Dang (Tadashi_Cin) 2024-11-07 21:07:16 +07:00 committed by GitHub
parent aeace96c48
commit 42a5cbd21e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 17 deletions

View File

@ -81,6 +81,12 @@ RUN --mount=type=ssh \
pip install -e "libs/kotaemon[adv]" \ pip install -e "libs/kotaemon[adv]" \
&& pip install unstructured[all-docs] && pip install unstructured[all-docs]
# Install lightRAG
ENV USE_LIGHTRAG=true
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \
pip install aioboto3 nano-vectordb ollama xxhash lightrag-hku
# Clean up # Clean up
RUN apt-get autoremove \ RUN apt-get autoremove \
&& apt-get clean \ && apt-get clean \

View File

@ -289,29 +289,32 @@ SETTINGS_REASONING = {
USE_NANO_GRAPHRAG = config("USE_NANO_GRAPHRAG", default=False, cast=bool) USE_NANO_GRAPHRAG = config("USE_NANO_GRAPHRAG", default=False, cast=bool)
USE_LIGHTRAG = config("USE_LIGHTRAG", default=False, cast=bool) USE_LIGHTRAG = config("USE_LIGHTRAG", default=False, cast=bool)
GRAPHRAG_INDEX_TYPES = ["ktem.index.file.graph.GraphRAGIndex"]
if USE_NANO_GRAPHRAG: if USE_NANO_GRAPHRAG:
GRAPHRAG_INDEX_TYPE = "ktem.index.file.graph.NanoGraphRAGIndex" GRAPHRAG_INDEX_TYPES.append("ktem.index.file.graph.NanoGraphRAGIndex")
elif USE_LIGHTRAG: elif USE_LIGHTRAG:
GRAPHRAG_INDEX_TYPE = "ktem.index.file.graph.LightRAGIndex" GRAPHRAG_INDEX_TYPES.append("ktem.index.file.graph.LightRAGIndex")
else:
GRAPHRAG_INDEX_TYPE = "ktem.index.file.graph.GraphRAGIndex"
KH_INDEX_TYPES = [ KH_INDEX_TYPES = [
"ktem.index.file.FileIndex", "ktem.index.file.FileIndex",
GRAPHRAG_INDEX_TYPE, *GRAPHRAG_INDEX_TYPES,
] ]
GRAPHRAG_INDEX = { GRAPHRAG_INDICES = [
"name": GRAPHRAG_INDEX_TYPE.split(".")[-1].replace("Index", ""), # get last name {
"config": { "name": graph_type.split(".")[-1].replace("Index", ""), # get last name
"supported_file_types": ( "config": {
".png, .jpeg, .jpg, .tiff, .tif, .pdf, .xls, .xlsx, .doc, .docx, " "supported_file_types": (
".pptx, .csv, .html, .mhtml, .txt, .md, .zip" ".png, .jpeg, .jpg, .tiff, .tif, .pdf, .xls, .xlsx, .doc, .docx, "
), ".pptx, .csv, .html, .mhtml, .txt, .md, .zip"
"private": False, ),
}, "private": False,
"index_type": GRAPHRAG_INDEX_TYPE, },
} "index_type": graph_type,
}
for graph_type in GRAPHRAG_INDEX_TYPES
]
KH_INDICES = [ KH_INDICES = [
{ {
@ -325,5 +328,5 @@ KH_INDICES = [
}, },
"index_type": "ktem.index.file.FileIndex", "index_type": "ktem.index.file.FileIndex",
}, },
GRAPHRAG_INDEX, *GRAPHRAG_INDICES,
] ]