Skip to content

Commit e4b58c4

Browse files
Merge pull request #372 from neo4j-documentation/update-energy-example
Update Energy Agent Example
2 parents 82d1bfe + 6712d03 commit e4b58c4

File tree

3 files changed

+41
-11
lines changed

3 files changed

+41
-11
lines changed
-86.1 KB
Loading
110 KB
Loading

modules/genai-ecosystem/pages/energy-agent.adoc

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,66 @@ The data for this demo comes from a combination of publicly available https://ww
1515

1616
The below walks through creating a graph, configuring NeoConverse with the appropriate tools, and sample questions you can ask to test the resulting agent.
1717

18+
[NOTE]
19+
====
20+
**Note: Other Agentic GraphRAG Examples**
21+
22+
This energy example is relatively simple with a very minimal agent. To see richer end-to-end graph construction and multi-agent workflows, take a look at these examples:
23+
24+
* https://github.com/neo4j-product-examples/neo4j-supplier-graph[Supplier and bill of materials (BOM)]
25+
* https://github.com/neo4j-product-examples/neo4j-employee-graph[Employee/HR knowledge graph].
26+
27+
Both examples provide deeper insights into building high-quality agents and comprehensive graph construction workflows. They are a bit more technical, opting for Google's Agent Development Kit (ADK) framework.
28+
====
29+
1830
== Create the Graph
1931

20-
I am still working on cleaning up a full ingestion workflow from source data. For now, you can load the data using the following backup file. Simply
32+
**Prerequisites:**
33+
34+
1. Neo4j Instance: You can create a Neo4j AuraDB instance at https://console.neo4j.io/. You can use the Aura Pro trial for free. During setup, you'll download a credentials file needed for later configuration.
35+
36+
2. https://platform.openai.com/api-keys[OpenAI API key]
2137

22-
1. Download https://drive.google.com/file/d/1d9UCR_Clg5KBVaKEqLpoRhtyFSQiVjoU/view?usp=sharing[this Neo4j DB backup file]
23-
2. Create a Neo4j AuraDB instance at https://console.neo4j.io/ with at least 2GB RAM. You can use the Aura Pro trial for free.
24-
3. Import the backup by selecting the instance you just created in the Aura console then select "Backup & Restore" -> "Restore from backup file" and drag and drop the backup
38+
**Graph Creation:**
39+
40+
You can create the graph in the above Neo4j DB in a couple of ways:
41+
42+
1. Create the graph from source data files by running the `create-graph.ipynb` notebook in https://github.com/neo4j-product-examples/neo4j-energy-graph[this GitHub repository]. Simply clone the repo, `pip install -r requirements.txt`, and create a `nb.env` file with the appropriate credentials using `nb.env.template` as a reference. Then you can run the entire notebook.
43+
44+
2. Download https://github.com/neo4j-product-examples/neo4j-energy-graph/blob/main/neo4j-energy-graph.backup[this Neo4j DB backup file] and import it into your AuraDB instance by selecting the instance in the Aura console, then select "Backup & Restore" -> "Restore from backup file" and drag and drop the backup. You will see the loading screen below while the database updates.
2545

2646
image::energy-agent-aura-import.png[align=center]
2747

28-
To see a similar end-to-end structured + unstructured graph construction workflow, take a look at https://github.com/neo4j-product-examples/neo4j-supplier-graph[this supplier and bill of materials (BOM) example] or https://github.com/neo4j-product-examples/neo4j-employee-graph[this example for an employee/HR knowledge graph].
48+
Both ways will produce the same graph. The first way will just let you see the ETL & data mapping process from tables and text files.
49+
2950

3051
== Configure NeoConverse
3152
We will use https://neo4j.com/labs/genai-ecosystem/neoconverse/[NeoConverse] to prototype a graphRAG agent. To set it up with all the right tools:
3253

33-
1. Download the json file https://drive.google.com/file/d/1XTx2glK4i9u-39lmKVboV-JKDZP22LBV/view?usp=sharing[here] and substitute
34-
- `<YOUR OPENAI API KEY>` with a valid openai api key.
35-
- the connection string `"connection":{"port":"7687","database":"<NEO4J_DATABASE>","host":"<NEO4J_URI>","password":"<NEO4J_PASSWORD>","protocol":"neo4j+s","username":"<NEO4J_USERNAME>"}` with your neo4j credentials from above.
54+
1. Download the json file https://github.com/neo4j-product-examples/neo4j-energy-graph/blob/main/energy-agent-neoconverse.json[here] and substitute
55+
- `<YOUR OPENAI API KEY>` with a valid openai api key (it appears in two places).
56+
- the connection json
57+
`"connection": {
58+
"port": "7687",
59+
"database": "neo4j",
60+
"host": "xxxxxx.databases.neo4j.io",
61+
"password": "<password>",
62+
"protocol": "neo4j+s",
63+
"username": "neo4j"
64+
},` with your neo4j credentials from above.
3665
2. Go to Neoconverse and open the developer console. In Chrome this is generally
3766
- `Cmd + Option + J` or `Option + ⌘ + I` on a Mac and
3867
- `Ctrl + Shift + J` or `F12` on Windows.
3968
3. in the developer console go to application -> local storage and replace the `AgentDataDict` value with the content of that json file (just copy past in), and reload the page. If you do not see an `AgentDataDict` go ahead and create one by pressing the "Add Agent" button in the left side-panel, this should make an `AgentDataDict` key-value pair appear.
40-
4. After this reload the page and you should get an agent to appear in the left side-panel called "ACME Energy Service Assets Analyst".
69+
4. After this reload the page and you should get an agent to appear in the left side-panel called "Energy Service Analyst".
4170

4271
image::energy-agent-neoconverse.png[align=center]
4372

4473
You should be able to open up the agent details in the left side-panel and look at the "TOOLS FOR LLM" page to explore relevant tools. The relevant tools fror us will be:
4574

4675
1. `search_equipment_maintenance_records`
4776
2. `get_risky_equipment`
48-
3. `get_installation_equipments_dependency`
77+
3. `get_installation_equipment_dependency`
4978

5079
image::energy-agent-tools.png[align=center]
5180

@@ -54,7 +83,8 @@ image::energy-agent-tools.png[align=center]
5483
Below are some sample questions you can ask:
5584

5685
1. Search equipment that presented vibration issues and list and summarize the description. Provide the maintenance history and calculate the average number of days between maintenance. Structure the information in topics. Also, suggest a possible relationship between maintenance and alerts.
57-
2. Can you develop a maintenance schedule over the next two weeks to address high-risk equipment while minimizing installation disturbance? Please provide specific dates & times. It is Feb 18th 2025 today.
86+
87+
2. Can you develop a maintenance schedule over the next two weeks to address high-risk equipment while minimizing installation disturbance? Please provide specific dates, times, and maintenance activities. It is Feb 18th 2025 today.
5888

5989
This should produce responses using the tools configured. Below is a video with outputs from a previous run:
6090
++++

0 commit comments

Comments
 (0)