-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate nano-graphrag (#433)
* add nano graph-rag * ignore entities for relevant context reference * refactor and add local model as default nano-graphrag * feat: add kotaemon llm & embedding integration with nanographrag * fix: add env var for nano GraphRAG --------- Co-authored-by: Tadashi <tadashi@cinnamon.is>
- Loading branch information
Showing
7 changed files
with
465 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .graph_index import GraphRAGIndex | ||
from .nano_graph_index import NanoGraphRAGIndex | ||
|
||
__all__ = ["GraphRAGIndex"] | ||
__all__ = ["GraphRAGIndex", "NanoGraphRAGIndex"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from typing import Any | ||
|
||
from ..base import BaseFileIndexRetriever | ||
from .graph_index import GraphRAGIndex | ||
from .nano_pipelines import NanoGraphRAGIndexingPipeline, NanoGraphRAGRetrieverPipeline | ||
|
||
|
||
class NanoGraphRAGIndex(GraphRAGIndex): | ||
def _setup_indexing_cls(self): | ||
self._indexing_pipeline_cls = NanoGraphRAGIndexingPipeline | ||
|
||
def _setup_retriever_cls(self): | ||
self._retriever_pipeline_cls = [NanoGraphRAGRetrieverPipeline] | ||
|
||
def get_retriever_pipelines( | ||
self, settings: dict, user_id: int, selected: Any = None | ||
) -> list["BaseFileIndexRetriever"]: | ||
_, file_ids, _ = selected | ||
retrievers = [ | ||
NanoGraphRAGRetrieverPipeline( | ||
file_ids=file_ids, | ||
Index=self._resources["Index"], | ||
) | ||
] | ||
|
||
return retrievers |
Oops, something went wrong.