-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoC: Added initial Knowledge Graph support #1801
base: main
Are you sure you want to change the base?
Conversation
@@ -494,24 +558,28 @@ def get_ingestion_component( | |||
embed_model=embed_model, | |||
transformations=transformations, | |||
count_workers=settings.embedding.count_workers, | |||
llm=kwargs.get("llm"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels error prone, can't you use the type directly?
@@ -48,7 +52,10 @@ def _try_loading_included_file_formats() -> dict[str, type[BaseReader]]: | |||
".mbox": MboxReader, | |||
".ipynb": IPYNBReader, | |||
} | |||
return default_file_reader_cls | |||
optional_file_reader_cls: dict[str, type[BaseReader]] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can move it back with the default readers, you are importing it unconditionally anyway
graph_store=graph_store_component.graph_store | ||
if graph_store_component and graph_store_component.graph_store | ||
else None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can simplify this with just graph_store_component.graph_store
, the component can't be None
. The dependency injector would fail before that.
retrievers = [ | ||
r for r in [vector_index_retriever, graph_knowledge_retrevier] if r | ||
] | ||
retriever = RouterRetriever.from_defaults( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
past experience with llama-index makes me not trust these from_defaults
, can you check the implementation to make sure it's doing sane things only (for example, some defaults try to call OpenAI if you omit one of the parameters)
@@ -389,10 +412,12 @@ class Settings(BaseModel): | |||
ollama: OllamaSettings | |||
azopenai: AzureOpenAISettings | |||
vectorstore: VectorstoreSettings | |||
graphstore: GraphStoreSettings | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a non-nullable type here and add a enabled
property instead, makes it easier to configure through env vars that way
@@ -0,0 +1,92 @@ | |||
# mypy: ignore-errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit dangerous, what types were giving trouble?
"""Read RDF files. | ||
|
||
This module is used to read RDF files. | ||
It was created by llama-hub but it has not been ported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it was ported to llama-index 0.1.0 with fixes, right? This sentence is a little bit confusing...
Is the Knowledge Graph functionality working? Has anyone tried it? |
Is the PR still alive? Are you going to make it more generic such that it will be able to support more Graph Databases? |
Knowledge Graph
This PR introduces knowledge graph capabilities.
What is a knowledge graph?
A knowledge graph is a collection of nodes and edges that represent entities or concepts, and their relationships, such as facts, properties, or categories.
It can be used to query or infer factual information about different entities or concepts, based on their node and edge attributes.
Changes Made
Knowledge Graph Support:
Neo4j Graph Store Provider:
RDF File Support (Turtle Syntax):
Router Retriever Support (Ensemble retrievers):
TODO
How to activate it?
In order to select one or the other, set the
graphstore.database
property in thesettings.yaml
file toneo4j
. It will be need to install extragraph-stores-neo4j
.To configure Neo4J connection, set the
neo4j
object in thesettings.yaml
.Run local Neo4J using Docker
To run Neo4j using Docker, you can use the following command: