fix: update Docker file for graphrag (#477) #none
This commit is contained in:
parent
42a5cbd21e
commit
6a81c77dd8
|
@ -46,7 +46,7 @@ RUN --mount=type=ssh \
|
||||||
|
|
||||||
RUN --mount=type=ssh \
|
RUN --mount=type=ssh \
|
||||||
--mount=type=cache,target=/root/.cache/pip \
|
--mount=type=cache,target=/root/.cache/pip \
|
||||||
if [ "$TARGETARCH" = "amd64" ]; then pip install graphrag future; fi
|
if [ "$TARGETARCH" = "amd64" ]; then pip install "graphrag<=0.3.6" future; fi
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
RUN apt-get autoremove \
|
RUN apt-get autoremove \
|
||||||
|
|
|
@ -204,7 +204,7 @@ documents and developers who want to build their own RAG pipeline.
|
||||||
- **Non-Docker Installation**: If you are not using Docker, install GraphRAG with the following command:
|
- **Non-Docker Installation**: If you are not using Docker, install GraphRAG with the following command:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install graphrag future
|
pip install "graphrag<=0.3.6" future
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Setting Up API KEY**: To use the GraphRAG retriever feature, ensure you set the `GRAPHRAG_API_KEY` environment variable. You can do this directly in your environment or by adding it to a `.env` file.
|
- **Setting Up API KEY**: To use the GraphRAG retriever feature, ensure you set the `GRAPHRAG_API_KEY` environment variable. You can do this directly in your environment or by adding it to a `.env` file.
|
||||||
|
|
|
@ -150,16 +150,26 @@ async def lightrag_build_local_query_context(
|
||||||
for k, n, d in zip(results, node_datas, node_degrees)
|
for k, n, d in zip(results, node_datas, node_degrees)
|
||||||
if n is not None
|
if n is not None
|
||||||
]
|
]
|
||||||
use_text_units = await _find_most_related_text_unit_from_entities(
|
|
||||||
node_datas, query_param, text_chunks_db, knowledge_graph_inst
|
try:
|
||||||
)
|
use_text_units = await _find_most_related_text_unit_from_entities(
|
||||||
use_relations = await _find_most_related_edges_from_entities(
|
node_datas, query_param, text_chunks_db, knowledge_graph_inst
|
||||||
node_datas, query_param, knowledge_graph_inst
|
)
|
||||||
)
|
except Exception:
|
||||||
|
use_text_units = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
use_relations = await _find_most_related_edges_from_entities(
|
||||||
|
node_datas, query_param, knowledge_graph_inst
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
use_relations = []
|
||||||
|
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Local query uses {len(node_datas)} entities, "
|
f"Local query uses {len(node_datas)} entities, "
|
||||||
f"{len(use_relations)} relations, {len(use_text_units)} text units"
|
f"{len(use_relations)} relations, {len(use_text_units)} text units"
|
||||||
)
|
)
|
||||||
|
|
||||||
entites_section_list = [["id", "entity", "type", "description", "rank"]]
|
entites_section_list = [["id", "entity", "type", "description", "rank"]]
|
||||||
for i, n in enumerate(node_datas):
|
for i, n in enumerate(node_datas):
|
||||||
entites_section_list.append(
|
entites_section_list.append(
|
||||||
|
@ -226,7 +236,9 @@ class LightRAGIndexingPipeline(GraphRAGIndexingPipeline):
|
||||||
)
|
)
|
||||||
|
|
||||||
all_docs = [
|
all_docs = [
|
||||||
doc.text for doc in docs if doc.metadata.get("type", "text") == "text"
|
doc.text
|
||||||
|
for doc in docs
|
||||||
|
if doc.metadata.get("type", "text") == "text" and len(doc.text.strip()) > 0
|
||||||
]
|
]
|
||||||
|
|
||||||
yield Document(
|
yield Document(
|
||||||
|
|
|
@ -232,7 +232,9 @@ class NanoGraphRAGIndexingPipeline(GraphRAGIndexingPipeline):
|
||||||
)
|
)
|
||||||
|
|
||||||
all_docs = [
|
all_docs = [
|
||||||
doc.text for doc in docs if doc.metadata.get("type", "text") == "text"
|
doc.text
|
||||||
|
for doc in docs
|
||||||
|
if doc.metadata.get("type", "text") == "text" and len(doc.text.strip()) > 0
|
||||||
]
|
]
|
||||||
|
|
||||||
yield Document(
|
yield Document(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user