Appearance
Elsai Graph
Elsai Graph is a toolkit for building, storing, and querying knowledge graphs powered by LLMs. It bridges unstructured text and structured knowledge — enabling graph-powered RAG pipelines that understand relationships, not just similarity.
Architecture
Packages
| Package | Version | Purpose |
|---|---|---|
elsai-graph-constructor | 0.1.0 | Extract entities and relationships from text |
elsai-graph-generator | 0.1.0 | Store graphs in Neo4j; manage vector indexes |
elsai-graph-query-rag | 0.1.0 | Answer natural language questions from the graph |
Requirements: Python >= 3.10, Neo4j instance (for generator and query-rag)
Quick end-to-end example
python
# Step 1 — Extract graph from text
from elsai_graph_constructor import GraphConstructor
constructor = GraphConstructor(llm=llm)
success, message, graph_data = constructor.construct_graph(chunks=[
{"chunk_id": "c1", "text": "Alice works at Acme Corp in Paris."},
{"chunk_id": "c2", "text": "Acme Corp is a leader in aerospace technology."},
])
# Step 2 — Store in Neo4j
from elsai_graph_generator import Neo4jConnector, GraphStorage, EmbeddingManager
connector = Neo4jConnector(uri="bolt://localhost:7687", user="neo4j", password="password")
connector.connect()
storage = GraphStorage(connector)
storage.store_graph(graph_data)
embedding_manager = EmbeddingManager(connector, embedding_model)
embedding_manager.create_vector_index("entity_embeddings")
embedding_manager.embed_nodes()
# Step 3 — Query the graph
from elsai_graph_query_rag import Neo4jRetriever, HybridGraphRetriever, GraphRAGEngine
neo4j_retriever = Neo4jRetriever(connector, llm)
hybrid_retriever = HybridGraphRetriever(connector, embedding_manager, neo4j_retriever)
rag_engine = GraphRAGEngine(neo4j_retriever, hybrid_retriever, llm)
success, message, answer = rag_engine.ask("Where does Alice work?")
print(answer)Next steps
- Graph Construction — entity & relationship extraction
- Graph Storage — Neo4j storage and vector indexing
- Graph RAG — answering questions from the graph